JP-Quiz-1

JP-Quiz-1

University

18 Qs

quiz-placeholder

Similar activities

Java_ScriptES

Java_ScriptES

8th Grade - University

15 Qs

Quiz on C Fundamentals for CSE & CST

Quiz on C Fundamentals for CSE & CST

University

20 Qs

C Programming Quiz

C Programming Quiz

University

20 Qs

Round 4 - Harvest

Round 4 - Harvest

University

15 Qs

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

University

15 Qs

JS-KT2 (Sub)

JS-KT2 (Sub)

University

20 Qs

D-Bug (C++)

D-Bug (C++)

University

15 Qs

Technical Quiz - Round 2

Technical Quiz - Round 2

University

15 Qs

JP-Quiz-1

JP-Quiz-1

Assessment

Quiz

Computers

University

Hard

Created by

Jeena KK

Used 1+ times

FREE Resource

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

String og = "helloworld";

String og2 = new String(og);

System.out.println((og==og2) + " "+ (og.equals(og2)));

true true

true false

false true

false false

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

int five = 5;

int two = 2;

int total = five + (five > 6 ? ++two : --two);

1

2

4

6

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which one is not a valid statement in Java?

double num = 2.718;

double num = 2._718;

double num = 2.7_1_8;

double num = 2.718;

double num = 2._718;

double num = 2.7_1_8;

none

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How many strings can be collected by Garbage Collector in the following code snippet?

public static void main(String[] fruits) {

String str1 = new String("open");

String str2 = new String("source");

String str2 = new String("opengenus");

str3 = str1;

str2 = str3;

str1 = str2;

}

0

1

2

3

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What line in this code snippet will give compilation error?

double d1 = 5f; // c1

double d2 = 5.0; // c2

float f1 = 5f; // c3

float f2 = 5.0; // c4

c1

c2

c3

c4

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code snippet?

public static void main(String... args) {

String car, bus = "petrol";

car = car + bus;

System.out.println(car); }

petrol

petrolpetrol

Compilation error

Runtime error

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which code statement give compilation error?

double num1, int num2 = 1; // C1

int num1, num2; // C2

int num1, num2 = 1; // C3

int num1 = 2, num2 = 1; // C4

c1

c2

c3

c4

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?