WorksheetsGEM of OOPJ
Total questions: 53
Worksheet time: 3615secs
What is the old name for Java Programming?
Java 2
Java
Oak
C++
Java is closely related to _________ programming language
C
Cobol
C++
Pascal
What is the file extension for Java Executable Code?
.java
.class
.exe
.obj
He is the developer of Java Programming Language
Dennis Ritchie
James Gosling
Bjarne Stroustrup
Ken Thompson
It is a type of java program that can be embedded in a web.
general purpose application
standalone applications
applet
webpage
Tools that provide support for software development process including editors and debuggers are called
integrated development environments
bytecode converters
virtual machine converters
memory verifier
Pick the correct syntax.
if(x == 5) {}
if(x = 5) {}
if x == 5 {}
if x = 5 {}
How many times will this loop run?
int x = 4;
while(x < 4) {
x = x + 1;
}
0
3
4
5
Which of the following is not a feature of Java
Robust
Platform Specific
Multithreaded
Object-Oriented
Hiding complexity can also be termed as
Inheritance
Overloading
Data hiding
Abstraction
Which feature makes it possible to write programs that can perform many tasks simultaneously.
Interpreted
Multithreaded
Efficient
Multi-purpose
Which from the following is a feature that allows us to perform a single action in different ways.
Abstraction
Polymorphism
Encapsulation
Inheritance
A code written using any programming language that is translated into binary code is called
Source code
Bytecode
Pseudocode
Flowchart
When was Java released?
1975
1985
1995
1990
To use a class or a package from the library which keyword is used
include
package
import
export
A class member can be accessed only by a class in the same package. Which is the suitable access specifier?
public
default
private
protected
A class member cannot be accessed by any other class inside or outside the package. Which is the suitable access specifier?
private
public
default
protected
Which of the following help to access all the classes in the package p1?
import p1;
import p1.*;
import p1.all;
import p1.A;
Multiple inheritance in Java can be achieved using
class and interface
class
interface
package
Which of the following is false?
Any number of classes can implement an interface.
Any number of interfaces can implement a class.
An interface can extend another interface.
A claas can extend another class
Which of the following is false?
Any number of classes can implement an interface.
Any number of interfaces can implement a class.
An interface can extend another interface.
A claas can extend another class
What type of variable can be defined in an interface?
public static
private final
public final
static final
What does an interface contain?
Method definition
Method declaration
Method declaration and definition
Method name
Which of the following is correct way of implementing an interface salary by class manager?
class manager extends salary {}
class manager implements salary {}
class manager imports salary {}
None of the mentioned.
What will be the output of the following Java program?
0 1 2
0 2 4
0 0 4
0 1 4
Abstract class can have constructors and static methods?
TRUE
FALSE
Abstract class can have constructors but can not have static methods.
Abstract class can not have constructors but can have static methods.
Which of these is not a correct statement?
Every class containing abstract method must be declared abstract
Abstract class defines only the structure of the class not its implementation
Abstract class can be initiated by new operator
Abstract class can be inherited
Compilation Error
A
B
Runtime error
null
life
universe
everything
Compilation fails.
Which exception or error will be thrown when a programmer attempts to run this code?
java.lang.StackOverflowError
java.lang.IllegalStateException
java.lang.ExceptionInInitializerError
java.lang.ArrayIndexOutOfBoundsException
Which of these keywords must be used to monitor for exceptions?
finally
catch
try
throw
throws
hello throwit caught
Compilation fails
hello throwit caught finally after
hello throwit RuntimeException caught after
12345
123450
1234500
Compilation Error
which of the following are valid
1,3
2,3,4
1,4
1,2,3,4,5
Choose the correct syntax of a Java Package below.
package PACKAGE_NAME;
package PACKAGE_NAME.*;
pkg PACKAGE_NAME;
pkg PACKAGE_NAME.*;
this is an example for
method overloading
method overriding
no output
C
compile time error
none of the above
What is the advantage of Exception Handling
To avoid abnormal termination of a program
To find out errors
To Debug program
None of these
What is the parent class of All Exceptions in JAVA
Throw
Exception
Error
Bug
Which of the following key word is optional in Exception handling program
try
catch
finally
throw
What is an exception
Error occurred during the execution of a program
Bug occurred during the compile time of a program
Simply an Error
It is related to input values
Which driver is efficient and always preferable for using JDBC applications?
Type-4
Type-3
Type-2
Type-1
Which packages contain the JDBC classes?
java.jdbc and javax.jdbc
java.jdbc and java.jdbc.sql
java.sql and javax.sql
java.rdb and javax.rdb
How can you retrieve information from a ResultSet?
By invoking the method get(…, String type) on the ResultSet, where type is the database type
By invoking the method get(…, Type type) on the ResultSet, where Type is an object which represents a database type
By invoking the method getValue(…), and cast the result to the desired Java type.
By invoking the special getter methods on the ResultSet: getString(…), getInt (…), getDouble(…),…
How can you execute a stored procedure in the database?
Call method execute() on a CallableStatement object
Call method executeProcedure() on a Statement object
Call method execute() on a StoredProcedure object
Call method run() on a ProcedureCommand object
what is the package name of "Class"?
java.util
java.sql
java.lang
java.io
What is true about DriverManager class?
It is class from java.lang package
It is a class from java.sql package
It is a interface from java.sql package
It is a class from java.lang package
What is JDBC?
JDBC is a java based protocol.
JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
JDBC is a specification to tell how to connect to a database.
Joint Driver for Basic Connection
What is JDBC?
JDBC is a java based protocol.
JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
JDBC is a specification to tell how to connect to a database.
Joint Driver for Basic Connection
what is true about getConnection() method?
It is a static method from DriverManager class
It is a non static method from DriverManager class
It is a static method from DriverManager interface
It is a non static method from DriverManager interface
JDBC Stands for _________
Java Database Connectivity
Java Driver Connectivity
Java Developer Connectivity
None of the above
