Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

GEM of OOPJ

Total questions: 53

Worksheet time: 3615secs

Name
Class
Date
1.
Which of the following is a correct header line for main in a Java program?
a)
public static void main(args)
b)
public static void main(String args)
c)
public static void main(args [ ])
d)
public static void main(String [ ] args)
2.

What is the old name for Java Programming?

a)

Java 2

b)

Java

c)

Oak

d)

C++

3.

Java is closely related to _________ programming language

a)

C

b)

Cobol

c)

C++

d)

Pascal

4.

What is the file extension for Java Executable Code?

a)

.java

b)

.class

c)

.exe

d)

.obj

5.

He is the developer of Java Programming Language

a)

Dennis Ritchie

b)

James Gosling

c)

Bjarne Stroustrup

d)

Ken Thompson

6.

It is a type of java program that can be embedded in a web.

a)

general purpose application

b)

standalone applications

c)

applet

d)

webpage

7.
Which of the following best describes what a variable is in computer programming terms?
a)
the value of x
b)
the value of y
c)
A named location of the computer's memory that will store data
d)
Any data that a computer will need to store
8.

Tools that provide support for software development process including editors and debuggers are called

a)

integrated development environments

b)

bytecode converters

c)

virtual machine converters

d)

memory verifier

9.

Pick the correct syntax.

a)

if(x == 5) {}

b)

if(x = 5) {}

c)

if x == 5 {}

d)

if x = 5 {}

10.

How many times will this loop run?

int x = 4;

while(x < 4) {

x = x + 1;

}

a)

0

b)

3

c)

4

d)

5

11.

Which of the following is not a feature of Java

a)

Robust

b)

Platform Specific

c)

Multithreaded

d)

Object-Oriented

12.

Hiding complexity can also be termed as

a)

Inheritance

b)

Overloading

c)

Data hiding

d)

Abstraction

13.

Which feature makes it possible to write programs that can perform many tasks simultaneously.

a)

Interpreted

b)

Multithreaded

c)

Efficient

d)

Multi-purpose

14.

Which from the following is a feature that allows us to perform a single action in different ways.

a)

Abstraction

b)

Polymorphism

c)

Encapsulation

d)

Inheritance

15.

A code written using any programming language that is translated into binary code is called

a)

Source code

b)

Bytecode

c)

Pseudocode

d)

Flowchart

16.

When was Java released?

a)

1975

b)

1985

c)

1995

d)

1990

17.

To use a class or a package from the library which keyword is used

a)

include

b)

package

c)

import

d)

export

18.

A class member can be accessed only by a class in the same package. Which is the suitable access specifier?

a)

public

b)

default

c)

private

d)

protected

19.

A class member cannot be accessed by any other class inside or outside the package. Which is the suitable access specifier?

a)

private

b)

public

c)

default

d)

protected

20.

Which of the following help to access all the classes in the package p1?

a)

import p1;

b)

import p1.*;

c)

import p1.all;

d)

import p1.A;

21.

Multiple inheritance in Java can be achieved using

a)

class and interface

b)

class

c)

interface

d)

package

22.

Which of the following is false?

a)

Any number of classes can implement an interface.

b)

Any number of interfaces can implement a class.

c)

An interface can extend another interface.

d)

A claas can extend another class

23.

Which of the following is false?

a)

Any number of classes can implement an interface.

b)

Any number of interfaces can implement a class.

c)

An interface can extend another interface.

d)

A claas can extend another class

24.

What type of variable can be defined in an interface?

a)

public static

b)

private final

c)

public final

d)

static final

25.

What does an interface contain?

a)

Method definition

b)

Method declaration

c)

Method declaration and definition

d)

Method name

26.

Which of the following is correct way of implementing an interface salary by class manager?

a)

class manager extends salary {}

b)

class manager implements salary {}

c)

class manager imports salary {}

d)

None of the mentioned.

27.

What will be the output of the following Java program?

a)

0 1 2

b)

0 2 4

c)

0 0 4

d)

0 1 4

28.

Abstract class can have constructors and static methods?

a)

TRUE

b)

FALSE

c)

Abstract class can have constructors but can not have static methods.

d)

Abstract class can not have constructors but can have static methods.

29.

Which of these is not a correct statement?

a)

Every class containing abstract method must be declared abstract

b)

Abstract class defines only the structure of the class not its implementation

c)

Abstract class can be initiated by new operator

d)

Abstract class can be inherited

30.

a)

Compilation Error

b)

A

c)

B

d)

Runtime error

31.
a)

null

b)

life

c)

universe

d)

everything

e)

Compilation fails.

32.

Which exception or error will be thrown when a programmer attempts to run this code?

a)

java.lang.StackOverflowError

b)

java.lang.IllegalStateException

c)

java.lang.ExceptionInInitializerError

d)

java.lang.ArrayIndexOutOfBoundsException

33.

Which of these keywords must be used to monitor for exceptions?

a)

finally

b)

catch

c)

try

d)

throw

e)

throws

34.
a)

hello throwit caught

b)

Compilation fails

c)

hello throwit caught finally after

d)

hello throwit RuntimeException caught after

35.

a)

12345

b)

123450

c)

1234500

d)

Compilation Error

36.

which of the following are valid

a)

1,3

b)

2,3,4

c)

1,4

d)

1,2,3,4,5

37.

Choose the correct syntax of a Java Package below.

a)

package PACKAGE_NAME;

b)

package PACKAGE_NAME.*;

c)

pkg PACKAGE_NAME;

d)

pkg PACKAGE_NAME.*;

38.

this is an example for

a)

method overloading

b)

method overriding

39.
a)

no output

b)

C

c)

compile time error

d)

none of the above

40.

What is the advantage of Exception Handling

a)

To avoid abnormal termination of a program

b)

To find out errors

c)

To Debug program

d)

None of these

41.

What is the parent class of All Exceptions in JAVA

a)

Throw

b)

Exception

c)

Error

d)

Bug

42.

Which of the following key word is optional in Exception handling program

a)

try

b)

catch

c)

finally

d)

throw

43.

What is an exception

a)

Error occurred during the execution of a program

b)

Bug occurred during the compile time of a program

c)

Simply an Error

d)

It is related to input values

44.

Which driver is efficient and always preferable for using JDBC applications?

a)

Type-4

b)

Type-3

c)

Type-2

d)

Type-1

45.

Which packages contain the JDBC classes?

a)

java.jdbc and javax.jdbc

b)

java.jdbc and java.jdbc.sql

c)

java.sql and javax.sql

d)

java.rdb and javax.rdb

46.

How can you retrieve information from a ResultSet?

a)

By invoking the method get(…, String type) on the ResultSet, where type is the database type

b)

By invoking the method get(…, Type type) on the ResultSet, where Type is an object which represents a database type

c)

By invoking the method getValue(…), and cast the result to the desired Java type.

d)

By invoking the special getter methods on the ResultSet: getString(…), getInt (…), getDouble(…),…

47.

How can you execute a stored procedure in the database?

a)

Call method execute() on a CallableStatement object

b)

Call method executeProcedure() on a Statement object

c)

Call method execute() on a StoredProcedure object

d)

Call method run() on a ProcedureCommand object

48.

what is the package name of "Class"?

a)

java.util

b)

java.sql

c)

java.lang

d)

java.io

49.

What is true about DriverManager class?

a)

It is class from java.lang package

b)

It is a class from java.sql package

c)

It is a interface from java.sql package

d)

It is a class from java.lang package

50.

What is JDBC?

a)

JDBC is a java based protocol.

b)

JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

c)

JDBC is a specification to tell how to connect to a database.

d)

Joint Driver for Basic Connection

51.

What is JDBC?

a)

JDBC is a java based protocol.

b)

JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.

c)

JDBC is a specification to tell how to connect to a database.

d)

Joint Driver for Basic Connection

52.

what is true about getConnection() method?

a)

It is a static method from DriverManager class

b)

It is a non static method from DriverManager class

c)

It is a static method from DriverManager interface

d)

It is a non static method from DriverManager interface

53.

JDBC Stands for _________

a)

Java Database Connectivity

b)

Java Driver Connectivity

c)

Java Developer Connectivity

d)

None of the above