java MCQ

java MCQ

University

10 Qs

quiz-placeholder

Similar activities

Array

Array

University

11 Qs

Java Control Flow Statements

Java Control Flow Statements

University

10 Qs

Java Bootcamp Day 4

Java Bootcamp Day 4

University

15 Qs

OOPs Quiz

OOPs Quiz

University

10 Qs

Round 4 - Harvest

Round 4 - Harvest

University

15 Qs

Java - meeting 1

Java - meeting 1

University

10 Qs

Talent Next Java MCQ-1

Talent Next Java MCQ-1

University

10 Qs

Java Operators

Java Operators

University

14 Qs

java MCQ

java MCQ

Assessment

Quiz

Computers

University

Hard

Created by

Kashaf Khan

Used 6+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Print the output of following code snippet.

{

  int p= 5000;

  int q=2000;

while(-- p < ++ q);

System.out.println(p);

}

a) 4999

5000

4989

4888

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

 public class XYZ

{

  public static void main(String[] args)

{

  short x = 50, Y;

  Y = x * 100;

  System.out.print(y);

  }

}

1

Run time error

5000

Compile time error

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class XYZ

 {

  public static void main(String[] args) {

  String str = "GLBAJAJ";

  str = "GLBIAN";

  System.out.println(str);

  }

}

"GLBAJAJ"

GLBIAN

GLBIAN"

GLBIAN

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

 public class XYZ {

  public static void main(String arg[]) {

  int i;

  for (i = 1; i <= 12; i += 2) {

  if (i == 8) {

  System.out.println(i);

  break;

  }

  }

  }

}

A. No output

2

23232

121

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the instanceof operator?

Check if an object is an instance of a specific class or interface

Compare two object references

Check if an object is an instance of a specific class or interface

Multiply instances

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

 Print the output of following code snippet.

{

  int p= 5000;

  int q=2000;

while(-- p < ++ q)

System.out.println(p);

}

a) No any output

a) Compile time error

a) Run time error

0

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which method in java is used to generate random numbers in Java?

random.nextInt()

random()

rand()

All of these

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?