Quizz_TG

Quizz_TG

University

40 Qs

quiz-placeholder

Similar activities

Law on Sales

Law on Sales

University

40 Qs

Quiz 1 (AIJ - Internet Gateway, NAT, Firewall)

Quiz 1 (AIJ - Internet Gateway, NAT, Firewall)

KG - Professional Development

40 Qs

Java

Java

University - Professional Development

42 Qs

Business Law - Exam prep

Business Law - Exam prep

University

35 Qs

ELEMENTS OF CONTRACT

ELEMENTS OF CONTRACT

University

45 Qs

Basics of Programming in Java (CH.9)

Basics of Programming in Java (CH.9)

University

45 Qs

python-important questions

python-important questions

University

36 Qs

OOP final

OOP final

University

43 Qs

Quizz_TG

Quizz_TG

Assessment

Quiz

Other

University

Easy

Created by

Q Mr.

Used 6+ times

FREE Resource

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image

What is the output for the below code ?

Compile fail due to error on line no 2
Compile fail due to error on line no 9
Compile fail due to error on line no 8
15

2.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
What is the output for the below code ? public class A { int k; boolean istrue; static int p; public void printValue() { System.out.print(k); System.out.print(istrue); System.out.print(p); } } public class Test { public static void main(String argv[]) { A a = new A(); a.printValue(); } }
0 false 0
0 true 0
0 0 0
Compile error - static variable must be initialized before use.

3.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
What is the output for the below code ? package com; class Animal { public void printName() { System.out.println("Animal"); } } package exam; import com.Animal; public class Cat extends Animal { public void printName() { System.out.println("Cat"); } } package exam; import com.Animal; public class Test { public static void main(String[] args) { Animal a = new Cat(); a.printName(); } }
Animal
Cat
Animal Cat
Compile Error

4.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
What is the output for the below code ? public class A { static { System.out.println("static"); } { System.out.println("block"); } public A() { System.out.println("A"); } public static void main(String[] args){ A a = new A(); } }
A block static
static block A
static A
A

5.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
What is the output for the below code ? 1. public class Test { 2. public static void main(String[] args){ 3. int i = 010; 4. int j = 07; 5. System.out.println(i); 6. System.out.println(j); 7. } 8. }
8 7
10 7
Compilation fails with an error at line 3
Compilation fails with an error at line 5

6.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
What is the output for the below code ? public class Test { public static void main(String[] args) { String value = "abc"; changeValue(value); System.out.println(value); } public static void changeValue(String a) { a = "xyz"; } }
abc
xyz
Compilation fails
Compilation clean but no output

7.

MULTIPLE CHOICE QUESTION

2 mins • Ungraded

Media Image
try{ File f = new File("a.txt"); }catch(Exception e){ }catch(IOException io){ } Is this code create new file name a.txt ?
True
False
Compilation Error
None

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?