MCQ's on Java Programming

You will find the correct answer of all the questions after you will submit the quiz. You will also get a report of your performance after you will submit the quiz.
Unlimited attempts possible to practice. On each attempts you will get a set of 25 questions.


Enter Your Name

MCQ 1:
Which of the following is not OOPS concept in Java?

MCQ 2:
Which of the following is a type of polymorphism in Java?

MCQ 3:
When does method overloading is determined?

MCQ 4:
When Overloading does not occur?

MCQ 5:
Which concept of Java is a way of converting real world objects in terms of class?

MCQ 6:
Java programs are

MCQ 7:
Which concept of Java is achieved by combining methods and attribute into a class?

MCQ 8:
Which one of the following is true for Java

MCQ 9:
What is it called if an object has its own lifecycle and there is no owner?

MCQ 10:
How many times does the following code segment execute int x=1, y=10, z=1; do{y>0; x++; y-=2; y=z; z++} while (y>1 && z<10);

MCQ 11:
State weather the following statement is true or false for EJB.1. EJB exists in the middle-tier2. EJB specifies an execution environment3. EJB supports transaction processing

MCQ 12:
What is it called where child object gets killed if parent object is killed?

MCQ 13:
_________________are not machine instructions and therefore, Java interpreter generates machine code that can be directly executed by the machine that is running the Java program.

MCQ 14:
The command javac

MCQ 15:
Which of the following is not the java primitive type

MCQ 16:
Which component is responsible to optimize bytecode to machine code?

MCQ 17:
What is it called where object has its own lifecycle and child object cannot belong to another parent object?

MCQ 18:
Method overriding is combination of _____________ and _______________?

MCQ 19:
Which component is used to compile, debug and execute java program?

MCQ 20:
Which component is responsible to run java program?

MCQ 21:
Which statement is true about java?

MCQ 22:
Which of the below is invalid identifier with the main method?

MCQ 23:
What is the extension of java code files?

MCQ 24:
Which method will a web browser call on a new applet?

MCQ 25:
Which of the following is not mandatory in variable declaration?

MCQ 26:
What is the extension of compiled java classes?

MCQ 27:
How can we identify whether a compilation unit is class or interface from a .class file?

MCQ 28:
What is use of interpreter?

MCQ 29:
Java has its origin in

MCQ 30:
The command javac is used to

MCQ 31:
Java servlets are an efficient and powerful solution for creating ____________________ for the web.

MCQ 32:
Filters were officially introduced in the Servlet ___________________ specification.

MCQ 33:
Which is the root class of all AWT events

MCQ 34:
OOP features are i) Increasing productivity ii) Reusabilityiii) Decreasing maintenance cost iv) High vulnerability

MCQ 35:
Break statement is used to
1) get out of method
2) end aprogram
3) get out of a loop
4) get out of the system

MCQ 36:
Native protocol pure Java converts ________________ into the ______________ used by DBMSs directly.

MCQ 37:
The JDBC-ODBC bridge allows ________________ to be used as ________________ .

MCQ 38:
Which of the following is true about Java.

MCQ 39:
Command to execute compiled java program is

MCQ 40:
Java Servlet
i) is key component of server side java development
ii) is a small pluggable extension to a server that enhances functionality
iii) runs only in Windows Operating System
iv) allows developers to customize any java enabled server

MCQ 41:
Inner classes are

MCQ 42:
All java classes are derived from

MCQ 43:
The jdb is used to

MCQ 44:
What would happen if "String[]args" is not included as argument in the main method.

MCQ 45:
Which component is responsible for converting bytecode into machine specific code?

MCQ 46:
For execution of DELETE SQL query in JDBC, ________________ method must be used.

MCQ 47:
When a program class implements an interface, it must provide behavior for

MCQ 48:
In order to run JSP __________________ is required.

MCQ 49:
State true of false.
i) AWT is an extended version of swing
ii) Paint() of Applet class cannot be overridden

MCQ 50:
Prepared Statement object in JDBC used to execute _________________ queries.

MCQ 51:
In Java variables, if first increment of the variable takes place and then the assignment occurs. This operation is also called ___________________.

MCQ 52:
When the operators are having the same priority, they are evaluated from ________________ in the order they appear in the expression.

MCQ 53:
In java, __________________ can only test for equality, where as _________________ can evaluate any type of the Boolean expression.

MCQ 54:
The ___________________ looks only for a match between the value of the expression and one of its case constants.

MCQ 55:
System.in.read() is being used, the program must specify the __________________ clause.

MCQ 56:
By using ________________ you can force immediate termination of a loop, by passing the conditional expression and any remaining code in the body of the loop.

MCQ 57:
The out object is an object encapsulated inside the _________________ class, and represents the standard output device.

MCQ 58:
The third type of comment is used by a tool called __________________ for automatic generation of documentation.

MCQ 59:
In the second type the information written in java after // is ignored by the ______________.

MCQ 60:
The compiled java program can run on any __________________ plateform having Java Virtual Machine (JVM) installed on it.

MCQ 61:
Preparedstatement Object in JDBC is used to execute __________________ queries.

MCQ 62:
In JDBC ____________________ imports all Java classes concerned with database connectivity.

MCQ 63:
MS-SQL stores data in a _______________________ file format.

MCQ 64:
Ingres is a __________________.

MCQ 65:
In Java servlet method init( ) is called __________________ times.

MCQ 66:
State true or false for Java Program.
i) All class variables are instance variables
ii) All protected methods are friendly methods

MCQ 67:
State true or false for Java Program.
i) Data members of an interface are by default final
ii) An abstract class has implementations of all methods defined inside it.

MCQ 68:
____________________ of a remotely accessible object must implement __________________.

MCQ 69:
______________ is the key to ________________.

MCQ 70:
A method name myMethod( ) that needs two integer arguments is declared as

MCQ 71:
JSP embeds in _________________in __________________.

MCQ 72:
The class at the top of exception class hierarchy is ______________________.

MCQ 73:
In a java program, package declaration ____________________ import statements.

MCQ 74:
The class string belongs to ________________ package.

MCQ 75:
________________ package is used by compiler itself. So it does not need to be imported for use.

MCQ 76:
State true or false for the following statements in Java.
i) Java beans slow down software development process.
ii) Java Servlets do not have built in multithreading feature.

MCQ 77:
State whether true or false.
i) init( ) of servlet is called after a client request comes in
ii) Servlets are ultimately converted into JSP

MCQ 78:
What will be the result of compiling following code.
public class MyClass{
public static void main(String args[]){
System.out.println("In first main()?); } public static void main(char args[]){ System.out.println (?a?);}}

MCQ 79:
Match the following.Java
1) is a tool for debugging java programJavah
2) is a tool for creating C-like header filesJavap
3) runs java bytecodejdb
4) prints java code representation

MCQ 80:
The _______________ and _________________ classes are abstract classes that support reading and writing of byte streams.

MCQ 81:
What is the error in the following code? class Test { abstract void display( ); }

MCQ 82:
A package is a collection of

MCQ 83:
Which of the following methods belong to the string class?

MCQ 84:
What will be the output of the following code? byte x=64, y; y= (byte) (x<<2); System.out.println(y);

MCQ 85:
If m and n are int type variables, what will be the result of the expression m%n when m=5 and n=2 ?

MCQ 86:
Which of the following control expressions are valid for an if statement?

MCQ 87:
The concept of multiple inheritance is implemented in Java by

MCQ 88:
Which of the following do not represent legal flow control statements?

MCQ 89:
Data input is

MCQ 90:
Using which keyword we can access value of the instance variables and class variables of that class inside the method of that class itself.

MCQ 91:
If a variable is declared final, it must include ___________________value.

MCQ 92:
State true or false.
i) Jpanel is a class included in awt package.
ii) Anonymous classes are mostly used for event handling.
iii) Names of anonymous classes must be unique
iv) JOptionPane is an inner class

MCQ 93:
In java, string is a ___________________.

MCQ 94:
Methods can be overloaded with a difference only in the type of the return value.

MCQ 95:
Each method in a java class must have a unique name.

MCQ 96:
It is important feature of java that it always provides a default constructor to a class.

MCQ 97:
__________________ is the key to _________________.

MCQ 98:
State true of false.
i) Public can only be assigned to class
ii) Protected protects a statement
iii) Protected method is never accessible outside the package
iv) Friendly variable may be accessible outside class

MCQ 99:
In java a ____________________ is a sequence of characters.

MCQ 100:
Java programs perform I/O through ___________________.

MCQ 101:
What is byte code in the context of Java?

MCQ 102:
Which of the following statements about abstract methods/classes in Java is true?

MCQ 103:
Which of the following statement is false?

MCQ 104:
The new operator dynamically allocates ___________________ for an object and returns a reference to it.

MCQ 105:
Which of the following statements correctly describes an interface?

MCQ 106:
What is the priority of the Garbage collector thread of jdk?

MCQ 107:
_________________ is a feature that allows one interface to be used for a general class of actions.

MCQ 108:
The default package that is implicitly called in a java program is ________________.

MCQ 109:
Java was developed by the company

MCQ 110:
What is the file extension of compiled java program?

MCQ 111:
_________________ keyword is used to invoke the current object.

MCQ 112:
Which of the function is used to convert string to Number in java program?

MCQ 113:
What are the part in executing a Java program and their purposes?

MCQ 114:
Method overloading is one of the way that Java supports __________________.

MCQ 115:
Java support RMI. What does this RMI stands for?

MCQ 116:
Which of the following represent legal flow control statements?

MCQ 117:
The keywords reserved but used in the initial version of Java are

MCQ 118:
What is the default return type of main()

MCQ 119:
If m and n are int type variables, what will be the result of the expression m%n when m=-14 and n=-3?

MCQ 120:
Consider the following code if(number>=0) if(number>0) system.out.println(?Number is positive?); else system.out.println(?Number is negative?); What will be the output if number is equal to 0?

MCQ 121:
Consider the following class definition. class Student extends String{ } What happens when we try to compile this class?

MCQ 122:
What is the error in the following class definitions? abstract class XY { abstract sum(int x, int y){ } }

MCQ 123:
We would like to make a member of a class visible in all subclasses regardless of what package they are in. Which one of the following keywords would archive this?

MCQ 124:
The use of protected keyword to a member in a class will restrict its visibility as follows:

MCQ 125:
A java program is first _________________and ______________.

MCQ 126:
Byte code is also a ________________.

MCQ 127:
A private class is accessible from inside a __________________.

MCQ 128:
Consider the statement ?x=(a>b)?a:b?, then the value of x is 19, if a=19 and b=12

MCQ 129:
Adapter classes are used for ?????

MCQ 130:
________________ inheritance is enable by interface in java.

MCQ 131:
________________ is generated if a button is clicked in AWT.

MCQ 132:
If a variable is declared FINAL, it must include _________________ value.

MCQ 133:
Methods can be overloaded with a difference only in the type of the return value

MCQ 134:
Each method in a java class must have a unique name

MCQ 135:
It is an important feature of java that it always provides a default constructor to a class

MCQ 136:
In java RMI, stub is located in

MCQ 137:
The new keyword will i) create in instance of an object ii) create instance of a class iii) assign memory to an array iv) call the destructor of a class

MCQ 138:
ODBC stands for

MCQ 139:
Which of the following statement is/are true? i) The name of a java program file must match the name of the class with the extension .java ii) Two methods cannot have the same name in java

MCQ 140:
__________________ can appear only where in the body of a java method.

MCQ 141:
Which of the following will produce a value of 22 if x=22.9?

MCQ 142:
________________ is passed to a method by use of call by reference.

MCQ 143:
Using the keyboard interface you can fully abstract a _________________.

MCQ 144:
Java is designed for __________________ environment of the Internet.

MCQ 145:
Which of the following will produce a value of 10 if x=9.7?

MCQ 146:
Variable declared as ______________ do not occupy on a per instance basis.

MCQ 147:
Which of the following is not keyword?

MCQ 148:
The __________________ statement is used to terminate a statement sequence.

MCQ 149:
Multidimensional arrays are actually ______________.

MCQ 150:
Which of the following keywords are used to control access to a class member?
i) default
ii) abstract
iii) protected
iv) interface
v) public

MCQ 151:
________________ is used for initialize the value to the string object.

MCQ 152:
Which of the following methods can be used to remove a component from the display?

MCQ 153:
Which of the following statements are valid array declaration? i) int number(); ii) float average[ ]; iii) double[]marks; iv) counter int[];

MCQ 154:
Which of the following methods belong to the String class?

MCQ 155:
Which of the following in NOT represent legal flow control statements?

MCQ 156:
Object is an _____________ of class.

MCQ 157:
__________________ is the wrapper class.

MCQ 158:
Class is a _________________ entity.

MCQ 159:
Which of the following denotes a javadoc comment?

MCQ 160:
Object is a __________________ entity.

MCQ 161:
One interface can inherit another by use of the keyword _____________.

MCQ 162:
________________ must be the first non comment statement in the file

MCQ 163:
In java thread to thread communication is called ____________________.

MCQ 164:
Every method of a _______________ is implicitly final.

MCQ 165:
The string is defined in _________________ name space.

MCQ 166:
A ____________________ object cannot be modified after it is created.

MCQ 167:
__________________ is a special member function.

MCQ 168:
A _____________________ class may not have any abstract method.

MCQ 169:
Keyword _________________ is always a reference to the object.

MCQ 170:
________________ operators are overloaded for string objects?

MCQ 171:
________________ is a small unit of process.

MCQ 172:
__________________ is valid for if statement?

MCQ 173:
Wrapper class is a wrapper around a ________________ data type.

MCQ 174:
___________________ statement is valid for array declaration.

MCQ 175:
________________ operators which concatenates two strings.

MCQ 176:
Which is used for reading streams of raw bytes such as image data and for reading streams of characters,consider using FileReader?

MCQ 177:
Which class is used to uncompress the file in the deflate compression format, It provides facility to the other uncompression filters?

MCQ 178:
Which method is used to change the name of a thread?

MCQ 179:
Which mechanism is used when a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed?

MCQ 180:
How many reserved keywords are currently defined in the Java language?

MCQ 181:
Which constructor creates an empty string buffer with the specified capacity as length.

MCQ 182:
Which method Drops all changes made since the previous commit/rollback?

MCQ 183:
Which class provides stream to read binary data such as image etfrom the request object?

MCQ 184:
Abbreviate the term OGNL?

MCQ 185:
Which type of validation we must implement the Validateable interface (or extend ActionSupport class) and provide the implementation of validate method?

MCQ 186:
Which validates the given string with the specified regular expression,it can be used in password, security key etc.?

MCQ 187:
Abbreviate the term JMS?

MCQ 188:
Abbreviate the term DGC?

MCQ 189:
An RMI Server is responsible for __________________.

MCQ 190:
Java supports RMI, RMI Stands for?

MCQ 191:
Which Error Handling in Java handles runtime errors with exceptions, If an exception is not caught in your JSP or Servlet, Resin will use a special error page to send results back to the browser, Resin uses a default error page unless you explicitly provide an error page yourself?

MCQ 192:
Which one of the following is a java keyword?

MCQ 193:
Java declaration statement must end with

MCQ 194:
The loop keyword of java is

MCQ 195:
Java does not define which type modifier?

MCQ 196:
Which one of the following is access keyword?

MCQ 197:
Which one of the following languages is pure object oriented language?

MCQ 198:
Which one of the following is not a java keyword?

MCQ 199:
POP is a/an

MCQ 200:
Object oriented programming language, is

MCQ 201:
Java

MCQ 202:
?: is :

MCQ 203:
Which one of the following languages is suitable to implement the OOP concepts?

MCQ 204:
Java is a general purpose object oriented programming language developed by

MCQ 205:
Which one of the following web browsers uses just-in-time (JIT) complier?

MCQ 206:
The java visibility modifier is

MCQ 207:
In an object oriented programming

MCQ 208:
The default priority is

MCQ 209:
Which one of the following is not a wrap class?

MCQ 210:
The control flow which is not used in java is

MCQ 211:
Java does not use

MCQ 212:
A package is a collection of

MCQ 213:
The java variable is/are

MCQ 214:
Which one of the following concept is incorporated in building a java program?

MCQ 215:
The state of left cycle of a thread is

MCQ 216:
A package is a collection of

MCQ 217:
The java variable is/are

MCQ 218:
Which one of the following concept is incorporated in building a java program?

MCQ 219:
The state of left cycle of a thread is

MCQ 220:
Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed?

MCQ 221:
What can be accessed or inherited without actual copy of code to each program?

MCQ 222:
Which provides accessibility to classes and interface?

MCQ 223:
The following program is an example of? class Simple{ public static void main(String args[]){ String s="Sachin"; System.out.println(s.length());//6 } }

MCQ 224:
If you are inserting any value in the wrong index as shown below, 1. int a[]=new int[5]; 2. a[10]=50; it would result in ______.

MCQ 225:
The following program is an example for? class Student{ int id; String name; void display(){System.out.println(id+" "+name);}public static void main(String args[]){ Student s1=new Student(); Student s2=new Student(); s1.display(); s2.display(); }}

MCQ 226:
Which is used to call the stored procedures and functions?

MCQ 227:
Which interfaces provide methods for batch processing in JDBC?

MCQ 228:
Which cookie it is valid for single session only and it is removed each time when the user closes the browser?

MCQ 229:
Which configuration files are used in Struts?

MCQ 230:
Which component does the Entity bean represent the persistent data stored in the database?

MCQ 231:
What are the exceptions which have to be handled in a RMI client program?

MCQ 232:
Which of the following is an advantage of the statement ? Separation of business logic from JSP ?

MCQ 233:
Which kind of driver converts JDBC calls into calls on the client API for Oracle, Sybase, Informix, IBM DB2, or other DBMS?

MCQ 234:
What invokes immediately after the start() method and also any time the applet needs to repaint itself in the browser?

MCQ 235:
Which method can set or change the text in a Label?

MCQ 236:
Which defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements?

MCQ 237:
Which one of the following methods cannot be used to draw the outline of a square?

MCQ 238:
The thread may be in

MCQ 239:
The methods wait ( ) and notify ( ) are defined in

MCQ 240:
For the method that does not return a value, the keyword used is

MCQ 241:
By invoking repaint ( ) for a component, the AWT invokes the method

MCQ 242:
The correct statement from the following is/are

MCQ 243:
Java

MCQ 244:
Java

MCQ 245:
Major objective of object oriented approach is to

MCQ 246:
Java?s coordinate system has the origin (0,0) in the

MCQ 247:
The bitwise AND operator is represented by a single ampersand (&) and is surrounded on both sides by

MCQ 248:
The most common problem of writing a java program is

MCQ 249:
Inheritance