Java/Java Mcq Question Set 1 Sample Test,Sample questions

Question:
 Which method is used to perform DML statements in JDBC

1.executeUpdate()

2.executeQuery()

3.execute()

4.None of above


Question:
After the compilation of the java source code, which file is created by the JVM

1..class

2..doc

3..java

4..cdr


Question:
All collection classes are available in

1.java.util package

2.java.io package

3.java.lang package

4.java.awt package


Question:
All raw data types should be read and uploaded to the database as an array of

1.int

2.byte

3.char

4.bollean


Question:
Automatic type conversion in Java takes place when

1.Two type are compatible and size of destination type is equal of source type.

2.Two type are compatible and size of destination type is larger than source type.

3.Two type are compatible and size of destination type is shorter than source type.

4.All of the above


Question:
Converting a primitive type data into its corresponding wrapper class object instance is called

1.boxing

2.wrapping

3.autoboxing

4.instantiation


Question:
Execution of the program is always begins with

1.Main method

2.parent class

3.default package

4.class contain main method


Question:
How many primitive data types are there in Java?

1.5

2.6

3.7

4.8


Question:
If method have same name as class name and method don't have any return type then it is known as

1.Constructor

2.Destructors

3.Variable

4.Object


Question:
In Java byte, short, int and long all of these are

1.signed

2.unsigned

3.Both of the above

4.None of these


Question:
In java, gc() method is available in which package

1.java.io package

2.java.lang package

3.java.awt package

4.java.util package


Question:
Inheritance means

1.Sub class create object of super class

2.Sub class extends Base class

3.Sub class extends super class

4.All of the above


Question:
�In Java, the word true is ................

1.A Boolean literal

2.A Java keyword

3.Same as value 0

4.Same as value 1


Question:
�What is the output for the below code ? public class Test{public static void main(String[] args){int i = 010; int j = 07;System.out.println(i); System.out.println(j); } }

1.7 8

2.8 7

3.9 8

4.None


Question:
�What will be output of following program? public class Test{public static void main(String[] args){byte b=127; b++; b++; System.out.println(b); } }

1.127

2.-127

3.129

4.-129


Question:
�Which class cannot be subclassed (or extended) in java?

1.Final class

2.abstract class

3.parent class

4.None of above


Question:
JAR file contains the compressed version of

1..java file

2..jsp file

3..class file

4.None of above


Question:
Java is a ........... language.

1.moderate typed

2.strogly typed

3.weakly typed

4.none of these


Question:
JIT meaning

1.just in time

2.java in time

3.join in time

4.none of above


Question:
Methods that have same name, but different Parameter list and different definition known as

1.Overriding

2.Overloading

3.Constructor

4.none of these


Question:
Minimum threads in a program are

1.0

2.1

3.2

4.3


Question:
Object which can store group of other objects is called

1.Package

2.Wrapper

3.Java object

4.Collection object


Question:
Package of drawstring() method is

1.java.awt

2.javax.swing

3.java.applet

4.java.io


Question:
pow () is associated with which class

1.Input stream class

2.Object class

3.Math class

4.None of above


Question:
Process of creating exact copy of the existing object is called

1.overloading

2.overriding

3.cloning

4.coping


Question:
Program which executes applet is known as

1.JVM

2.virtual machine

3.applet engine

4.None of above


Question:
Runnable is

1.Interface

2.Class

3.Variable

4.Method


Question:
Size of float and double in Java is

1.32 and 64

2.64 and 64

3.32 and 32

4.64 and 32


Question:
Size of int in Java is

1.8 bit

2.16 bit

3.32 bit

4.64 bit


Question:
String is the predefined

1.Object

2.Variable

3.Class

4.Method


Question:
Super is the predefined

1.Method

2.Keyword

3.Keyword and Method

4.None of above


Question:
Suspend thread can be revived by using

1.yield() method

2.Suspend() method

3.start() method

4.resume() method


Question:
The class java.sql.Timestamp is associated with

1.java.util.Date

2.java.util.Time

3.java.sql.Time

4.None of above


Question:
The following fraction of code double STATIC = 2.5 ; System.out.println( STATIC );

1.Prints 2.5

2.Raises an exception

3.Raises an error as STATIC is used as a variable which is a keyword

4.None of these


Question:
The following program: public class Test{ static boolean is OK; public static void main(String args[]){System.out.print(is OK); } }

1.Prints true

2.Prints false

3.Will not compile as boolean is not initialized

4.Will not compile as boolean can never be static


Question:
The JDBC-ODBC bridge is

1.Singlethreaded

2.Multithreaded

3.Both of above

4.None of above


Question:
The smallest integer type is ......... and its size is ......... bits.

1.short, 8

2.byte, 8

3.short, 16

4.short, 16


Question:
Thread class is available in

1.java.lang package

2.java.util package

3.java.awt package

4.java.io package


Question:
What will the output of the following program? public class Test{ public static void main(String args[]){float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); } }

1.0

2.1

3.2

4.3


Question:
Which collection class associates values witch keys, and orders the keys according to their natural order

1.java.util.LinkedList

2.java.util.TreeMap

3.java.util.SortedSet

4.java.util.HashSet


Question:
Which method executes only once

1.stop() method

2.start() method

3.init() method

4.destroy() method


Question:
Which metrhods are utilized to control the access to an object in multi threaded programming

1.Synchronized methods

2.Asynchronized methods

3.Serialized methods

4.None of above


Question:
Which of the following automatic type conversion will be possible?

1.byte to int

2.short to int

3.long to int

4.int to long


Question:
Which of the following below are valid isolation levels in J2EE

1.TRANSACTION_READ_UNCOMMITTED

2.TRANSACTION_SERIALIZABLE

3.Only A

4.Both A and B


Question:
Which of the following statements about arrays is syntactically wrong

1.arrayName[] p = new arrayName[5];

2.arrayName p[][] = new arrayName[2][];

3.arrayName[] p [];

4.arrayName p[5];


Question:
Which statement is static and synchronized in JDBC API

1.getConnection()

2.executeQuery()

3.prepareCall()

4.executeUpdate()


Question:
Which type of inheritance is not supported by java

1.Single

2.Mulilevel

3.Hirarchical

4.Multiple


Question:
Why we use array as a parameter of main method

1.Can store multiple values

2.It is syntax

3.Both of above

4.None of above


Question:
x=x+1 is equivalent to

1.x++

2.++x

3.x=x-1

4.None of these


More MCQS

  1. Java Mcq Question Set 1
  2. Java Mcq Question Set 2
  3. Java Mcq Question Set 3
  4. Java Mcq Question Set 4
  5. Java Mcq Question Set 5
  6. Java Mcq Question Set 6
  7. Java Mcq Question Set 7
  8. Java Mcq Question Set 8
  9. Java Mcq Question Set 9
  10. Java Multiple Choice Questions
  11. DATA TYPES IN JAVA
  12. Classes ,Constructor ,Methods,Inheritance
  13. Java Multiple Choice Questions.
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!