JP-Quiz-1

JP-Quiz-1

University

18 Qs

quiz-placeholder

Similar activities

BUG BLUSTERS

BUG BLUSTERS

University

15 Qs

Round 2 for Preplacement Bootcamp

Round 2 for Preplacement Bootcamp

University

15 Qs

Introduction To Python

Introduction To Python

University

20 Qs

OOP - Java Classes

OOP - Java Classes

12th Grade - University

15 Qs

Python Quiz Ver- 1.3

Python Quiz Ver- 1.3

University

15 Qs

C Programming (Unit- 1) Quiz

C Programming (Unit- 1) Quiz

University

20 Qs

Java Programming

Java Programming

University

15 Qs

Final Quiz

Final Quiz

University

20 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?