Java Program

Java Program

University

10 Qs

quiz-placeholder

Similar activities

Jaringan Nirkabel - Pertemuan 3

Jaringan Nirkabel - Pertemuan 3

University

10 Qs

Information Technology & Business Canvas Model

Information Technology & Business Canvas Model

University

13 Qs

Ulangan harian 1 Algoritma dan Pemrograman

Ulangan harian 1 Algoritma dan Pemrograman

12th Grade - University

13 Qs

GIS Unit-1

GIS Unit-1

University

15 Qs

Microcontroller

Microcontroller

11th Grade - University

10 Qs

Input, output and storage de

Input, output and storage de

8th Grade - Professional Development

14 Qs

BCA

BCA

University

10 Qs

Assessment 08

Assessment 08

University

15 Qs

Java Program

Java Program

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

PUSHPALATHA C2114

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

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 Computers