flow control

flow control

University

10 Qs

quiz-placeholder

Similar activities

Talent Next Java MCQ-1

Talent Next Java MCQ-1

University

10 Qs

Inheritance

Inheritance

University

10 Qs

Temel Java Bilgisi Ölçme Testi

Temel Java Bilgisi Ölçme Testi

University

10 Qs

Java Control Flow Statements

Java Control Flow Statements

University

10 Qs

Java Control Flow and Collections

Java Control Flow and Collections

University

10 Qs

Java Operators

Java Operators

University

14 Qs

Array

Array

University

11 Qs

Java Static

Java Static

University

10 Qs

flow control

flow control

Assessment

Quiz

Computers

University

Hard

Created by

PUSHPALATHA C2114

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

1.What would be the output of the following code snippet if variable a=10?

  1. if(a<=0)

  2. {

  3. if(a==0)

  4. {

  5. System.out.println("1 ");

  6. }

  7. else

  8. {

  9. System.out.println("2 ");

  10. }

  11. }

  12. System.out.println("3 ");

a) 1 2

b) 2 3

c) 1 3

d) 3

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

2. What is true about a break?

a) Break stops the execution of entire program

b) Break halts the execution and forces the control out of the loop

c) Break forces the control out of the loop and starts the execution of next iteration

d) Break halts the execution of the loop for certain time frame

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3.What is true about do statement?

a) do statement executes the code of a loop at least once

b) do statement does not get execute if condition is not matched in the first iteration

c) do statement checks the condition at the beginning of the loop

d) do statement executes the code more than once always

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

4.What is the valid data type for variable “a” to print “Hello World”?


  1. switch(a)

  2. {

  3. System.out.println("Hello World");

  4. }

a) int and float

b) byte and short

c) char and long

d) byte and char

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

5.Which of these are selection statements in Java?

a) if()

b) for()

c) continue

d) break

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

6.Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

a) do-while

b) while

c) for

d) none of the mentioned

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

7.What will be the output of the following Java program?

  1. class selection_statements

  2. {

  3. public static void main(String args[])

  4. {

  5. int var1 = 5;

  6. int var2 = 6;

  7. if ((var2 = 1) == var1)

  8. System.out.print(var2);

  9. else

  10. System.out.print(++var2);

  11. }

  12. }

a) 1

b) 2

c) 3

d) 4

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?