SCJP MOCK EXAM-01 MCQ Question

SCJP MOCK EXAM-01 MCQ Question
1. Which of the following are valid for declaring and initialising a boolean variable?
  • boolean b = True;
  • boolean b = 0;
  • boolean b = 1 < 2;
  • boolean b = true?false:true;
Show Answer
2. Select the valid declarations.
  • int i = 16.0;
  • byte b = 16.0;
  • float f = 16.0;
  • double d = 16.0;
Show Answer
3. What it will print?System.out.println(Math.round(-4.7));
  • -5
  • -4
  • -4.5
  • 5
Show Answer
4. What it will print? System.out.println(Math. ceil (-4.7));
  • -5.0
  • -4.0
  • -4.5
  • 5.0
Show Answer
5. What it will print? System.out.println(Math.floor(-4.7));
  • -5.0
  • -4.0
  • -4.5
  • -5.0
Show Answer
6. What it will print? System.out.println(2 + 3 +"");
  • 32
  • error
  • 23
  • 5
Show Answer
7. What it will print? System.out.println(2 + "" + 3 );
  • 32
  • error
  • 23
  • 5
Show Answer
8. What it will print? System.out.println("" + 2 + 3 );
  • 32
  • error
  • 23
  • 5
Show Answer
9. What it will print?
  • 90
  • error
  • 30
  • 900
Show Answer
10. What it will print? int x= -7 % -2 System.out.println(x);
  • 1
  • error
  • -1
  • 0
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test