Q1. Name the character set supported by Java.
Q2. What is meant by token? Name the tokens available in Java.
Q3. What are keywords? Can keywords be used as identifiers?
Q4. What is an identifier? What is the identifier forming rule of Java.
Q5. Is Java case sensitive? What is meant by the term ‘case sensitive’?
Q6. Which of the following are valid identifiers and why/why not?
Q7. What are literal? How many types of integer literals are available in Java?
Q8. What is an integer constant? Write integer forming rule of Java.
Q9. How many types of integer constants are allowed in Java: How are they written?
Q10. What kind of program elements are the following: 13, ‘a’, 4.38925, “a”, main()?
Q11. What kind of constants are the following: 14, 011, 0X2A, 17, 014, 0XBC1?
Q12. What is a character constant in Java? How are nongraphic characters represented in Java?
Q13. Why are characters \, ‘, ” and ? typed using escape sequences?
Q14. Which escape sequences represent the newline character and null character?
Q15. What is a floating constant in Java? How many ways can a floating constant be represented into?
Q16. Write the following real constants into exponent form:
23.197, 7.214, 0.00005, 0.319
Q7. Write the following real constants into fractional form:
0.13E04, 0.417E-04, 0.4E-05, 0.123E02.
Q18. What are binary operators? Give examples of arithmetic binary operators.
Q19. What will be the result of a=5/3 if a is
Q20. The expression 8%3 evaluates to ______.
Q21. What will be the value of j= – – k + 2 * k + (l=k, l++) if k is 20 initially?
Q22. What will be the value of P=P* ++J where J is 22 and P=3 initially?
Q23. Assuming that res starts with the value 25, what will the following code fragment print out?
Q24. What will be the value of following, if j=5 initially?
- (5* ++j)%6
Q25. What will be the result of following expression if
- age=85 ?
age > 65 ? 350 : 100
Q26. What will be the result of following expression if
- ans=700, val=300
- ans=800, val=700
ans-val > 500 ? 150 : 50
Q27. Write equivalent Java expressions for the following expressions:
Q28. What is meant by implicit and explicit type conversion?
Q29. What do you mean by type casting? What is type cast operator?
Q30. What will be the resultant type of the following expression is if bh represents a byte variable, i is an int variable, fl is a float variable and db is a double variable?
- bh – i + db / fl – i * fl + db / i
- (int) ( fl + db )
Q31. Which class is used for using different mathematical methods in Java program?
Q33. The modulus operator(%) can be used only with integer operands. True/ False?
Q34. The range of values for the long type data is:
- -231 to 231
- -264 to 264
- -263 to 263
- -232 to 232 – 1
Q35. Which of the following represent(s) a hexadecimal number?
Q36. Which of the following assignments are invalid?
- float x=123.4
- long m=023
- int n=(int) false;
- double y=0X756
Q37. The default value of char type variable is
- ” “
Q38. What will be the result of the expression 13 & 25?
(1310 =000011012, 2510=000110012)
Q39. What will be result of the expression 9|9?
- None of the above.
Q40. Which of the following will produce a value of 22 if x=229?
Q41. Which of the following will produce a value of 10 if x=9.7?
Q42. Given the declarations
short x1=100, x2=200, x3=300;
Which of the following are evaluated to true?
- b = x1 + x2 != 3 * x1;
- b= (x3 -2 * x2 <0 || ((x3 = 400) < 2 ** x2);
- b= (x3 -2 * x2 > 0) || ((x3= 400)) 2* x2);