SCJP MOCK EXAM-01 MCQ Question Questions and Answers

Practice Mode
Showing 10 of 41 questions
Q1
Which of the following are valid for declaring and initialising a boolean variable?
  • A boolean b = True;
  • B boolean b = 0;
  • C boolean b = 1 < 2;
  • D boolean b = true?false:true;
Answer: Option
Q2
Select the valid declarations.
  • A int i = 16.0;
  • B byte b = 16.0;
  • C float f = 16.0;
  • D double d = 16.0;
Answer: Option
Q3
What it will print?System.out.println(Math.round(-4.7));
  • A -5
  • B -4
  • C -4.5
  • D 5
Answer: Option A
Q4
What it will print? System.out.println(Math. ceil (-4.7));
  • A -5.0
  • B -4.0
  • C -4.5
  • D 5.0
Answer: Option B
Q5
What it will print? System.out.println(Math.floor(-4.7));
  • A -5.0
  • B -4.0
  • C -4.5
  • D -5.0
Answer: Option A
Q6
What it will print? System.out.println(2 + 3 +"");
  • A 32
  • B error
  • C 23
  • D 5
Answer: Option D
Q7
What it will print? System.out.println(2 + "" + 3 );
  • A 32
  • B error
  • C 23
  • D 5
Answer: Option C
Q8
What it will print? System.out.println("" + 2 + 3 );
  • A 32
  • B error
  • C 23
  • D 5
Answer: Option C
Q9
What it will print?
  • A 90
  • B error
  • C 30
  • D 900
Answer: Option B
Q10
What it will print? int x= -7 % -2 System.out.println(x);
  • A 1
  • B error
  • C -1
  • D 0
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test