Wednesday, 21 August 2013

Java Programming - 10

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

Select The Blank
Question: The mechanism by which java frees the memory occupied by unused objects is ________.
Correct Answer: Garbage Collection
Your Answer: Garbage Collection

True/False
Question: Running threads can be suspended, which temporarily suspends its activity.
Correct Answer: True
Your Answer: True

Multiple Choice Single Answer
Question: Which Control Statements enable program execution to repeat one or more statements?
Correct Answer: Iteration
Your Answer: Break

Select The Blank
Question: The ________ repeat a set of code while the condition is false.
Correct Answer: While loop
Your Answer: For

Select The Blank
Question: The ________ is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.
Correct Answer: Continue
Your Answer: Exit

Multiple Choice Single Answer
Question: Which Control Statement allow the program to execute in a non-linear fashion?
Correct Answer: Jump
Your Answer: Selection

Multiple Choice Single Answer
Question: Which class can be extended?
Correct Answer: threadclass
Your Answer: threadclass

True/False
Question: A thread's priority is used to decide when to switch from one running thread to the next, this is called as the context switch.
Correct Answer: True
Your Answer: True

True/False
Question: Each class in java can have a finalizer method.
Correct Answer: True
Your Answer: True

Multiple Choice Multiple Answer
Question: Which of the following is the declaration of an array of string objects?
Correct Answer: String[ ] s; , String [ ]s: , String[ s]:
Your Answer: String[ s]: , String s[ ]:

Select The Blank
Question: Java virtual machine works as ________ for the the bytecode.
Correct Answer: Interpreter
Your Answer: Compiler

True/False
Question: Constructors can be overloaded like regular methods.
Correct Answer: True
Your Answer: True

Match The Following
Question Correct Answer Your Answer
Methods Member of Class Member of Class
Stack First In, Last Out First In, Last Out
Class Object Oriented Programming Simple class
Object Instance of Class Instance of Class

Multiple Choice Multiple Answer
Question: Java's multithreading system is built upon :-
Correct Answer: Thread class , Its methods , Companion interface
Your Answer: Thread class , Its methods , Companion interface

Multiple Choice Multiple Answer
Question: Which one does not extend java.lang.Number?
Correct Answer: Boolean , Character
Your Answer: Boolean , Character

Select The Blank
Question: The mechanism which binds together the code and data and keeps both safe is ________.
Correct Answer: Encapsulation
Your Answer: Encapsulation

True/False
Question: There is no Global Variable in Java.
Correct Answer: True
Your Answer: False

True/False
Question: Object oriented programming organizes a program around processes acting on data.
Correct Answer: False
Your Answer: False

Multiple Choice Multiple Answer
Question: Which loops can be nested in java?
Correct Answer: While , Do-while , For
Your Answer: Do-while , For , While

True/False
Question: Threads priorities are not integers that specify the relative priority of one thread to another.
Correct Answer: False
Your Answer: True

Multiple Choice Single Answer
Question: How can class be imported from a package to a program?
Correct Answer: import java.packagename.classname
Your Answer: import java.class

True/False
Question: When for loop start the execution, the initialization portion of the loop is executed.
Correct Answer: True
Your Answer: True

Multiple Choice Single Answer
Question: To import a class, what is a syntax used?
Correct Answer: import classname;
Your Answer: import classname;

Multiple Choice Multiple Answer
Question: Which are the java's control statements?
Correct Answer: For , If , Switch
Your Answer: For , If , Continue

Select The Blank
Question: The Process by which one object acquires properties of another object is ________.
Correct Answer: Inheritence
Your Answer: Inheritence

Select The Blank
Question: A ________ is declared by use of the class keyword.
Correct Answer: class
Your Answer: class( )

Select The Blank
Question: ________ variables are declared by use of the Byte Keyword.
Correct Answer: Byte
Your Answer: Short

Multiple Choice Single Answer
Question: Select the facility provided along with JVM which enhances speed of execution :-
Correct Answer: Just-In-Time (JIT) compiler.
Your Answer: Java compiler.

Multiple Choice Multiple Answer
Question: Method definition has four parts, they are :-
Correct Answer: Name of the method , Type of object , List of parameters
Your Answer: Name of the method , Type of object , Class

Multiple Choice Single Answer
Question: How many concrete classes can you have inside an interface?
Correct Answer: none
Your Answer: two

Multiple Choice Single Answer
Question: Which statement checks at the beginning of a loop to see whether the next loop iteration should occur?
Correct Answer: While
Your Answer: Do-while

Multiple Choice Single Answer
Question: How to change the values of the elements of the array?
Correct Answer: By using array subscript expression
Your Answer: By using array subscript expression

Multiple Choice Multiple Answer
Question: What are means of encapsulating and containing the name space and scope of variables and methods?
Correct Answer: Classes , Packages , Subclasses
Your Answer: Classes , Packages , Subclasses

Match The Following
Question Correct Answer Your Answer
Exit any loop Break Exit
If Else Else
Loop While While
Jump Break, continue, return Break, continue, return

True/False
Question: Casting between primitive types allows conversion of one primitive type to another.
Correct Answer: True
Your Answer: True

Select The Blank
Question: The smallest integer type is ________.
Correct Answer: Byte
Your Answer: Byte

Multiple Choice Single Answer
Question: class conditional { public static void main(String args[]) { int i = 20; int j = 55; int z = 0; z = i < j ? i : j; // ternary operator System.out.println("The value assigned is " + z); } } } What is output of the above program?
Correct Answer: The value assigned is 20
Your Answer: The value assigned is 20

Select The Blank
Question: Multiple inheritance in Java can be achieve by ________.
Correct Answer: Interface
Your Answer: Object

Multiple Choice Multiple Answer
Question: Exit statement is optional in which loops in java?
Correct Answer: While , Do-while , For
Your Answer: Do-while

Select The Blank
Question: The range of Byte is ________
Correct Answer: (-128 to 127)
Your Answer: (-128 to 127)

True/False
Question: In While loop condition can be any Boolean expression
Correct Answer: True
Your Answer: False

Select The Blank
Question: When java program starts up, one thread begin runing and it is called ________thread.
Correct Answer: main( )
Your Answer: main( )

Select The Blank
Question: The ________ statement defines a name space in which classes are stored
Correct Answer: Packages
Your Answer: New

Multiple Choice Multiple Answer
Question: Packages act as containers for :-
Correct Answer: Classes , Subordinate packages
Your Answer: Classes , Classes , Subclasses

Multiple Choice Single Answer
Question: How array is defined?
Correct Answer: int arr[];
Your Answer: int arr[];

Multiple Choice Multiple Answer
Question: What modifiers may be used with top-level class?
Correct Answer: Public , Abstract , Final
Your Answer: Public , Abstract , Final

Multiple Choice Multiple Answer
Question: Which statements can be used with the java's loop?
Correct Answer: Jump , Continue , Break
Your Answer: Jump , Continue , Break

No comments:

Post a Comment