Java Program

Java Program

University

10 Qs

quiz-placeholder

Similar activities

Java Arrays

Java Arrays

University

10 Qs

JAVA FINAL QUIZ FOR ASSESSMENT

JAVA FINAL QUIZ FOR ASSESSMENT

University

15 Qs

Kuis Dadakan ;)

Kuis Dadakan ;)

10th Grade - University

15 Qs

II CSM A & B

II CSM A & B

University

15 Qs

JAVA UNIT 1 PART 2

JAVA UNIT 1 PART 2

University

15 Qs

OOP Quiz

OOP Quiz

University

10 Qs

Skill Development - Debugging Practice1

Skill Development - Debugging Practice1

10th Grade - Professional Development

10 Qs

Java Programming Basics

Java Programming Basics

University

12 Qs

Java Program

Java Program

Assessment

Quiz

Computers

University

Hard

Created by

PUSHPALATHA C2114

Used 3+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

1.What will be the output of following Java code?

public class Main { public static void main(String[] args) { String str = "Hello"; str = "Bye"; System.out.println(str); } }

  1. Hello

  1. Bye

  1. Error

  1. All of these

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

2.public class Main { public static void main(String arg[]) { int i; for (i = 1; i <= 12; i += 2) { if (i == 8) { System.out.println(i); break; } } } }

  1. 1

  1. No output

  1. 8

  1. 1357911

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3.What will be the output of the following Java code?

  1. class increment {

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

  3. {

  4. int g = 3;

  5. System.out.print(++g * 8);

  6. }

  7. }

a) 32

b) 33

c) 24

d) 25

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

  1. class variable_scope

  2. {

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

  4. {

  5. int x;

  6. x = 5;

  7. {

  8. int y = 6;

  9. System.out.print(x + " " + y);

  10. }

  11. System.out.println(x + " " + y);

  12. }

  13. }

a) Compilation error

b) Runtime error

c) 5 6 5 6

d) 5 6 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. 5.What will be the output of the following Java code snippet?

  1. class abc

  2. {

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

  4. {

  5. if(args.length>0)

  6. System.out.println(args.length);

  7. }

  8. }

a) The snippet compiles and runs but does not print anything

b) The snippet compiles, runs and prints 0

c) The snippet compiles, runs and prints 1

d) The snippet does not compile

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

6.What will the following loop print?

for(int i = 0; i < 4; i++) { System.out.println(i); }

  • A.0 1 2

  • B.1 2 3

  • C.0 1 2 3

  • D.None

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

7.What is the output of this code?

int x = 1; while(x < 4) { System.out.println(x); x++; }

  • A.1 2 3

  • B.2 3 4

  • C.1 2 3 4

  • D.1

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?