Search Header Logo

PU - Day 1 assessments - Sivaram's class

Authored by training atomm

Professional Development

Professional Development

Used 1+ times

PU - Day 1 assessments - Sivaram's class
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

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

2
6
1
5

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class test_output

  2. {

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

  4. {

  5. int a = 10;

  6. int b = 20;

  7. if (a < b)

  8. System.out.print(a + b);

  9. else

  10. System.out.print(a - b);

  11. }

  12. }

20

-10

30

10

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class comparison_test

  2. {

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

  4. {

  5. int x = 15;

  6. int y = 10;

  7. if (x != y)

  8. System.out.print(x);

  9. else

  10. System.out.print(y);

  11. }

  12. }

0

10

15

20

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class increment_test

  2. {

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

  4. {

  5. int count = 5;

  6. if (++count > 5)

  7. System.out.print(count);

  8. else

  9. System.out.print(count - 1);

  10. }

  11. }

7

4

6

5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class logical_test

  2. {

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

  4. {

  5. boolean a = true;

  6. boolean b = false;

  7. if (a && b)

  8. System.out.print("True");

  9. else

  10. System.out.print("False");

  11. }

  12. }

Exception

Null

False

True

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class ternary_test

  2. {

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

  4. {

  5. int num = 8;

  6. String result = (num % 2 == 0) ? "Even" : "Odd";

  7. System.out.print(result);

  8. }

  9. }

Even

Odd

Null

None

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Java program?

  1. class switch_case_test

  2. {

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

  4. {

  5. int day = 3;

  6. switch (day)

  7. {

  8. case 1:

  9. System.out.print("Monday");

  10. break;

  11. case 2:

  12. System.out.print("Tuesday");

  13. break;

  14. case 3:

  15. System.out.print("Wednesday");

  16. break;

  17. default:

  18. System.out.print("Invalid day");

  19. }

  20. }

Tuesday

Monday

Wednesday

Invalid day

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?

Discover more resources for Professional Development