200 Real Time Java Multiple Choice Questions and Answers - Mcqs
200 Real Time Java Multiple Choice Questions and Answers - Mcqs
B) Platform independent
C) Not reusable
D) Not scalable
A) C programming language
B) PERRL
C) COBOL
5. Java servlets are an efficient and powerful solution for creating ………….. For the web.
A) Dynamic content
B) Static content
C) Hardware
D) Both a and b
A) 2.1
B) 2.3
C) 2.2
D) 2.4
A) java.awt.ActionEvent
B) java.awt.AWTEvent
C) java.awt.event.AWTEvent
D) java.awt.event.Event
i) Increasing productivity (ii) Reusability (iii) Decreasing maintenance cost (iv) High
vulnerability
A) 1,2 & 4
B) 1,2 & 3
C) 1, 2 & 4
i) get out of method (ii) end a program (iii) get out of a loop (iv) get out of the system
A) 1 & 2
B) 1,2 & 3
C) 1 & 3
D) 3
10. Native – protocol pure Java converts ……….. into the ………… used by DBMSs
directly.
B) Drivers, Application
D) Application, drivers
3. ……………. 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.
A) Compiled Instructions
B) Compiled code
C) byte code
A) Byte
B) Float
C) Character
D) Long double
A) java
B) javac
C) run
D) javaw
7. 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
A) anonymous classes
B) nested classes
C) sub classes
D) derived classes
9. How many times does the following code segment execute int x=1, y=10, z=1; do{y–;
x++; y-=2; y=z; z++} while (y>1 && z<10);
A) 1
B) 10
C) 5
D) infinite
10. State weather the following statement is true or false for EJB.
A) java.lang.Class
B) java.util.Name
C) java.lang.Object
D) java.awt.Window
3. What would happen if “String[]args” is not included as argument in the main method.
A) No error
B) Compilation error
C) Program won’t run
D) Program exit
4. For execution of DELETE SQL query in JDBC, …………. method must be used.
A) executeQuery()
B) executeDeleteQuery()
C) executeUpdate()
D) executeDelete()
A) main method
B) destroy method
C) execute method
D) init method
A) a semicolon
B) an identifier
C) an assignment
D) a data type
A) Mail Server
B) Applet viewer
A) i-false, ii-false
B) i-false,ii-true
C) i-true, ii-false
D) i-true, ii-true
A) Executable
B) Simple
C) High level
D) Parameterized
1. In Java variables, if first increment of the variable takes place and then the assignment
occurs. This operation is also called ……………………….. .
A) pre increment
B) post increment
C) incrementation
D) pre incrementation
2. When the operators are having the same priority, they are evaluated
from……………..…………. in the order they appear in the expression.
A) right to left
B) left to right
D) depends on compiler
3. In java , …………. can only test for equality, whereas ………… can evaluate any type of
the Boolean expression.
A) switch, if
B) if, switch
C) if, break
D) continue, if
4. The ………………….. Looks only for a match between the value of the expression and
one of its case constants.
A) if
B) match
C) switch
5. System.in.read() is being used, the program must specify the ……………… clause.
A) throws.java.out.IOException
B) throws.java.in.IOException
C) throws.java.io.IOException
D) throws.java.io.InException
6. 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.
A) Break
B) Continue
C) Terminate
D) Loop Close
7. The out object is an object encapsulated inside the …………….. class, and represents the
standard output device.
A) standard
B) local
C) globlal
D) system
8. The third type of comment is used by a tool called ……………… for automatic
generation of documentation.
A) Java commenting
B) Java generator
C) Java doc
D) Java loc
9. In the second type the information written in java after // is ignored by the
…………………..
A) Interpreter
B) Compiler
C) Programmer
10. The compiled java program can run on any ………………… plateform having Java
Virtual Machine (JVM) installed on it.
A) program
B) java
C) hardware
D) non java
A) executable
B) simple
C) high level
D) parameterized
A) javax.sql.*
B) java.mysql.*
C) java.sql.*
D) com.*
A) .DAT
B) .MDB
C) .MSSQL
D) .OBJ
4. Ingres is a ……………………
A) Socket
B) Compiler
C) Database
D) Web server
A) 1
B) 2
C) 0
D) multiple
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true
ii) An abstract class has implementations of all methods defined inside it.
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true
B) class, RemoteException
C) class, RemoteInterface
A) Serialization, persistence
B) Persistence, inheritance
C) Inheritance, object
D) Persistence, serialization
10. A method name myMethod( ) that needs two integer arguments is declared as
A) Servlet, HTML
B) HTML, Java
C) HTML, Servlet
D) Java, HTML
A) ArithmeticException
B) Throwable
C) Class
D) Exception
A) must precede
B) must succeed
D) none
A) java.awt
B) java.lang
C) java.applet
D) java.string
5. …………… package is used by compiler itself. So it does not need to be imported for use.
A) java.math
B) java.awt
C) java.applet
D) java.lang
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true
A) i-false, ii-false
B) i-false, ii-true
C) i-true, ii-false
D) i-true, ii-true
System.out.println(„a‟);
A) Code will not compile and will give “Duplicate main () method declaration” error
C) Code will compile correctly and will print “In first main()” (without quotes) when it
is run
D) Code will compile correctly and will print “a” (without quotes) when it is run
A) a-3, b-2,c-1
1. The ……………… and ……………….. classes are abstract classes that support reading
and writing of byte streams.
A) reader, writer
B) inputstream, outputstream
C) objectinputstream, objectoutputstream
D) none
class Test
{
A) No error
3. A package is a collection of
A) classes
B) interfaces
C) editing tools
A) length( )
B) compare To ( )
C) equals ( )
D) All of them
byte x=64, y;
y= (byte) (x<<2);
System.out.println(y);
A) 0
B) 1
C) 2
D) 64
6. If m and n are int type variables, what will be the result of the expression m%n when m=5
and n=2 ?
A) 0
B) 1
C) 2
A) An integer expression
B) A Boolean expression
C) Either A or B
D) Neither A nor B
D) both B and C
A) break;
B) return;
C) exit();
D) continue outer;
A) super
B) final
C) this
A) integer
B) no
C) initial
D) float
ii) Anonymous classes are mostly used for event handling. iii) Names of anonymous classes
must be unique
C) combination of boolean
5. Methods can be overloaded with a difference only in the type of the return value ..
A) Not supported
B) False
C) True
A) Not necessary
B) True
C) False
iv) x precede +
A) Not supported
B) False
C) True
A) Serialization, persistence
B) Persistence, inheritance
C) Inheritance, object
D) Persistence, serialization
A) string
B) arrayChar
C) groupChar
D) collection
A) I/O methods
B) I/O package
C) streams
D) compiler
C) A thread can be temporarily suspended from running by using the wait() method.
D) A suspended thread using suspend () method can be revived using the resume() method.
6. The new operator dynamically allocates …………..for an object and returns a reference to
it.
A) classes
B) variables
C) memory
D) It‟s a subclass
A) Low Priority
B) Highest Priority
C) Medium Priority
D) Decided at run time
9. ……………. is a feature that allows one interface to be used for a general class of actions.
A) Class
B) Inheritance
C) Polymorphism
D) Interface
10. The default package that is implicitly called in a java program is ………….
A) java.Lang
B) java.System
C) java.Window
D) java.Lang.System
A) Sun Micro systems Image representing Sun Microsystems as depicte… Sun Micro
systems Image CrunchBase
B) Microsoft
C) Micro tech
D) IBM
A) .class
B) .java
C) .css
D) .html
A) New
B) That
C) This
D) Me
A) to Number()
B) conString()
C) valueOf()
D) toString()
5. What are the part in executing a Java program and their purposes?
A) Java Compiler
B) Java Interpreter
C) Java Pre-processor
D) Directive Pre-processor
A) encapsulation
B) class
C) inheritence
D) polymorphism
A) break;
B) break();
C) continue(inner);
D) exit();
9. The keywords reserved but used in the initial version of Java are
A) union
B) const
C) inner
D) goto
A) void
B) double
C) float
D) int
1. If m and n are int type variables, what will be the result of the expression m%n when m=-
14 and n=-3?
A) 4
B) 2
C) -2
D) -4
if(number>=0)
if(number>0)
system.out.println(“Number is positive”);
else
system.out.println(“Number is negative”);
A) Number is negative
B) Number is positive
C) Both A and B
char c=‟a‟;
switch (c)
{ case „a‟;
system.out.println(“A”);
case „b‟;
system.out.println(“B”);
default; system.out.println(“C”); }
A) Output will be A
D) Code is illegal and therefore will not compile 4. Consider the following class
definition.class Student extends String
{}
What happens when we try to compile this class? A) Will not compile because class body is
not defined
A) Nothing is wrong
B) Wrong. Method show () should have a return type
D) No error.
ii) The abstract methods of an abstract class must be defined in its subclass.
iii) We cannot declare abstract constructors. iv) We may declare abstract static methods.
A) Line i only
B) Line ii only
8. 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?
A) Private
B) Protected
C) Public
D) Private Protected
9. The use of protected keyword to a member in a class will restrict its visibility as follows:
A) Visible only in the class and its subclass in the same package.
{return (x&y);
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
A. i- only
B. ii- only
C. Both i and ii
A. 570
B. (hex)5
C. 0X9F
D. 0X5
3) …….. can appear only where in the body of a java method.
A. definition
B. declaration
C. determine
D. package
i) The modulus operator (%) can be used only with integer operands
A. i-True, ii-False
B. i-False, ii-True
C. i-True, ii-True
D. i-False, ii-False
A. ceil(x)
B. round(x)
C. rint(x)
A. Variables
B. Objects
C. Methods
D. Operators
A. Method
B. Keyword
C. Class
D. Variables
8) State True or False for the following statements in java. i) All the bitwise operators have
same level of precedence in java ii) The default can is always required in the switch selection
structure.
A. i-True, ii-False
B. i-False, ii-True
C. i-True, ii-True
D. i-False, ii-False
A. Development
B. Deduction
C. Distributed
D. Web Design
A. floor(x)
B. abs(x)
C. rint(x)
D. round(x)
A. Static
B. Final
C. Abstract
D. Code
A. NULL
B. implements
C. protected
D. switch
13) The …… statement is used to terminate a statement sequence.
A. Break
B. Switch
C. Continue
D. Wait
A. Arrays of element
B. Arrays of variable
C. Arrays of arrays
D. Arrays of variable
15) Which of the following keywords are used to control access to a class member?
16) ……. is used for initialize the value to the string object.
A. Character literals
B. String literals
D. Group literals
17) Which of the following methods can be used to remove a component from the display?
A. delete()
B. remove()
C. disappear()
D. hide()
18) Which of the following statements are valid array declaration? i) int number(); ii) float
average[ ]; iii) double[]marks; iv) counter int[];
A. i and ii
B. ii and iii
C. iii and iv
A. length()
B. CompareTo()
C. equals()
D. substring()
20) Which of the following in NOT represent legal flow control statements?
A. break;
B. break();
C. continues outer;
D. return;
A. instance
B. implements
C. inheritance
D. invoke
A. Random
B. Byte
C. Vector
D. String
A. logical
B. Physical
C. up normal
D. collection of
A. //#
B. /*
C. /**
D. //**
B. physical
C. logical
D. normal
A. public
B. extends
C. method name
D. class name
A. package
B. class
C. object
D. declaration
A. passing
B. sending
C. messaging
D. calling
A. static class
B. dynamic class
C. final class
D. abstract class
A. java.Lang
B. java.String
C. java.Char
D. java.Awt
A. double
B. int
C. string
D. main
A. method
B. class
D. constructor
13) A …….. class may not have any abstract method.
A. abstract
B. static
C. final
D. public
A. new
B. this
C. invoke
D. class
A. -,+
B. +,=
C. <<,>>
D. ++,–
A. method
B. thread
C. applet
D. steam
A. An integer expression
B. A Boolean expression
C. A character expression
D. A legal expression
B. central
C. primitive
D. concrete
A. int number();
B. float number();
C. float number[];
D. count int[];
A. +
B. ++
C. –
D. +-
January 17, 2017 iqapdf JAVA Multiple Choice Questions Leave a Comment
100 REAL TIME BOOTSTRAP Multiple Choice Questions and Answers | MCQs →
Interview Questions and Answers pdf free download for freshers experienced MCQs
Real time certification basic asked objective programming on IT & NON-IT Placement
Papers FAQs