Search Header Logo

QUIZ ON OPERATORS & CONTROL STATEMENTS

Authored by Renugadevi Professor

Computers

University

Used 1+ times

QUIZ ON OPERATORS & CONTROL STATEMENTS
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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. }

1

2

3

4

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

  1. class comma_operator

  2. {

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

  4. {

  5. int sum = 0;

  6. for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1)

  7. sum += i;

  8. System.out.println(sum);

  9. }

  10. }

5

6

14

compialtion error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class Output

  2. {

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

  4. {

  5. final int a=10,b=20;

  6. while(a<b)

  7. {

  8.  

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

  10. }

  11. System.out.println("World");

  12.  

  13. }

  14. }

Hello

run time error

Hello world

compile time error

5.

FILL IN THE BLANK QUESTION

1 min • 1 pt

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 ");

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is returned by “greater than”, “less than” and “equal to” operators?

Integers

Floating – point numbers

Boolean

None of the mentioned

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these operators can skip evaluating right hand operand?
a) !



a) !

b) |

c) &

d) &&

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?