VERY SHORT QUES-PF

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

  1. float 
  2. int?

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?

System.out.println(res–);

System.out.println(++res);

Q24. What will be the value of following, if j=5 initially?

  1. (5* ++j)%6
  2. (5*j++)%6

Q25. What will be the result of following expression if

  1. age=25
  2. age=65
  3. age=85 ?

age > 65 ? 350 : 100

Q26. What will be the result of following expression if

  1. ans=700, val=300
  2. ans=800, val=700

ans-val > 500 ? 150 : 50

Q27. Write equivalent Java expressions for the following expressions:

  1. ut+1/2ft2
  2. |a|+b>=|b|+a 
  3. e|2x^2-4x|

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?

  1. bh – i + db / fl – i * fl + db / i
  2. (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:

  1. -231 to 231
  2. -264 to 264
  3. -263 to 263
  4. -232 to 232 – 1

Q35. Which of the following represent(s) a hexadecimal number?

  1. 570
  2. (hex)5
  3. 0X9G
  4. 0X5

Q36. Which of the following assignments are invalid?

  1. float x=123.4
  2. long m=023
  3. int n=(int) false;
  4. double y=0X756

Q37. The default value of char type variable is

  1. ‘\u0020’
  2. ‘\u00ff
  3. ” “
  4. ‘\u000’

Q38. What will be the result of the expression 13 & 25?  

(1310 =000011012, 2510=000110012)

  1. 38
  2. 25
  3. 9
  4. 12

Q39. What will be result of the expression 9|9?

  1. 1
  2. 18
  3. 9
  4. None of the above.

Q40. Which of the following will produce a value of 22 if x=229?

  1. Math.ceil(x)
  2. Math.round(x)
  3. Math.abs(x)
  4. Math.floor(x)

Q41. Which of the following will produce a value of 10 if x=9.7?

  1. Math.floor(x)
  2. Math.abs(x)
  3. Math.round(x)
  4. Math.ceil(x)

Q42. Given the declarations

boolean b;

short x1=100, x2=200, x3=300;

Which of the following are evaluated to true?

  1. b=x1*2==x2;
  2. b = x1 + x2 != 3 * x1;
  3. b= (x3 -2 * x2 <0 || ((x3 = 400) < 2 ** x2);
  4. b= (x3 -2  * x2 > 0) || ((x3= 400)) 2* x2);
%d bloggers like this: