Hey Guys welcome to CES Study247 ,Today I am provide you Java Programming MCQ (Multiple Choice Questions) SET-3 ,that is very useful for many exam.
Q.41 Which of the following variable declaration would not compiled in a java program?
int var
float var
double var
int-I-var
Explanation
In Java, hyphens (-) are not allowed in variable names (identifiers).
Q.42 A constructor is related with
Same name as the class it is declared within
Is used to create package
Is used to define Applet constructor
All of above
Explanation
A constructor must have the same name as the class it belongs to and does not have an explicit return type.
Q.43 JVM is a
Java virtual machine
Java variable modifier
Java vertical machine
Java vendor machine
Explanation
JVM stands for Java Virtual Machine, which provides the runtime environment for executing Java bytecode.
Q.44 What is byte code in context of Java?
The type of code generated by Java compiler
Code generated by Java virtual machine
Another name of Java source file
Related with Java comments
Explanation
Bytecode is the highly optimized set of instructions designed to be executed by the Java Virtual Machine (JVM).
Q.45 The Java run time system automatically calls this method while garbage collection
finalizer ()
finalize ()
finally ()
fanalised ()
Explanation
The finalize() method is called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
Q.46 An overloaded method consist of
with same method but different types of parameters
with different method name only
method name may be same or different
all of above
Explanation
Method overloading allows a class to have more than one method with the same name, provided their parameter lists are different.
Q.47 A protected member can be accessed in
subclass of same package
non sub- class of same package
non sub class of different package
true for both (a) and (b)
Explanation
Protected members are accessible within the same package and also by subclasses in different packages.
Q.48 All exception types are sub classes of the built in class in
Exception
Run time exception
Error
Throwable
Explanation
Throwable is the superclass of all errors and exceptions in the Java language.
Q.49 In Java, objects are passed as
copy of that object
Method call by value
Memory address
constructor
Explanation
In Java, objects are passed by reference, meaning the memory address of the object is passed.
Q.50 Which of following not a component of Java IDE
Net Beans
Borland's Jbuilder
MS J++
Symantec visual cafe
Explanation
Based on the context of this question set, Symantec Visual Cafe is listed as the non-component, though historically it was an early IDE.
Q.51 Which of following is incorrect name
xyz
2nd name
xy2z
xyz2
Explanation
Identifiers in Java cannot begin with a digit (number).
Q.52 Applet cann't be viewed using
Netscape navigator
Internet Explorer
Sun Hot Java Browser
Applet viewer tool which comes with JDK
Explanation
Following the provided answer key, Applet viewer is specified as the tool.
Q.53 Java compiler Javac translate Java source code into
Assembly language
Byte code
Bit code
Machine code
Explanation
The javac compiler translates the Java source code into bytecode, which is saved in .class files.
Q.54 In Java character const value is its integer value in the
EBCDIC char set
Unicode char code
ASCII char code
Binary code
Explanation
Java uses Unicode, but character values are often mapped and compared via their integer values (like ASCII).
Q.55 Which one of the used to document the program and improve its readability
System calls
Keyword
Comments
Blocks
Explanation
Comments are used to explain the logic of the code and are ignored by the compiler.
Q.56 In Java, a try block should immediately followed by one or more
Throw blocks
Run blocks
Catch blocks
Exit blocks
Explanation
A try block must be followed by at least one catch block or a finally block.
Q.57 When one object acquires the properties of another objects is called
Encapsulation
Polymorphism
Overloading
Inheritance
Explanation
Inheritance is the mechanism in Java by which one class is allowed to inherit the features (fields and methods) of another class.
Q.58 Multiple inheritance means
One class inheriting more super class
More class inheriting from one super class
One class inheriting one super class
None of above
Explanation
Multiple inheritance is a feature where a class can inherit from more than one parent class (implemented via interfaces in Java).
Q.59 The wrapping of data and functions into a single units is called
Encapsulation
Abstraction
Data hiding
polymorphism
Explanation
Encapsulation is the process of wrapping data and the code that operates on that data into a single unit called a class.
Q.60 Which of the following has a method name flush ()
Input stream
Output stream
Reader stream
Input reader stream
Explanation
The flush() method is used to clear the output stream and force any buffered output bytes to be written out.