Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java Quiz1 @ VCE (CSE (AI&ML))

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Where an object of a class get stored?

a)

Heap

b)

Stack

c)

Memory

d)

Disk

2.

Garbage collection in Java is

a)

Unused package in a program automatically gets deleted.

b)

Java deletes all unused java files on the system.

c)

Memory occupied by objects with no reference is automatically reclaimed for deletion.

d)

The JVM cleans output of Java program.

3.

Which is the important Concept in the following in Java?

a)

Compiler

b)

JVM

c)

Interpreter

d)

All the Above

4.

______ binds the data and functions into single unit.

a)

Function

b)

Package

c)

Class

d)

All the Above

5.

Who invented Java?

a)

Berkly

b)

James Gosling

c)

Dr. E.F.Codd

d)

Sergy Brin

6.

_________________ is a collection of elements used to store the same type of data.

a)

Array

b)

Class

c)

List

d)

Switch

7.

int [] nums = {2, 3, 5, 8, 9, 11};

How would you access the fourth element in nums?

a)

nums[4]

b)

nums(3)

c)

nums[3]

d)

nums[4]

8.

Index values of an array range from ______________.

a)

1 to length

b)

0 to length-1

c)

0 to length

d)

0 to length+1

9.

Name the data type: "true"

a)

char

b)

String

c)

boolean

d)

Array

10.

What data type would you use for storing the average test score in a class?

a)

int

b)

double

c)

boolan

d)

String

11.

How would you declare a variable that tells you that someone passed a class?

a)

boolean passed='true';

b)

boolean passed="true";

c)

boolean passed=true;

d)

String passed="true";

12.

a=1;

a++;

a)

1

b)

2

c)

3

d)

4

13.

Which statement(s) are equivalent to i = i + 1?

a)

i+=1

b)

i++

c)

i-=1

d)

i--

14.

Find the output for the following.

 

public class IncDec

 

{

public static void main(String s[])

 

{

 

int a = 1;

 int b = 2;

int c;

 int d;

 c = ++b;

 d = a++;

c++;

 System.out.println("a = " + a);

 System.out.print("b = " + b);

 System.out.println("c = " + c);

 System.out.print("d = " + d);

 

}

 

}

a)

a = 1 b = 2 c = 4 d = 2

b)

Program does not compile.

c)

a = 2 b = 3 c = 4 d = 1

d)

a = 2 b = 3 c = 4 d = 1      

15.

Which feature of OOP allows us to hide few details and gives exposure to some of the details

a)

Polymorphism

b)

Encapsulation

c)

Abstraction

d)

Inheritance