Thursday 22 August 2013

Java Programming - 18

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

True/False
Question: Casting occurs commonly between numeric types
Correct Answer: True
Your Answer: True

Multiple Choice Multiple Answer
Question: When might your program wish to run the garbage collector?
Correct Answer: Before it enters a compute-intense section of code , Before it enters a memory-intense section of code , When it knows there will be some idle time
Your Answer: When it knows there will be some idle time , Before it enters a memory-intense section of code

Multiple Choice Single Answer
Question: What are members of the threads class?
Correct Answer: Method
Your Answer: Method

True/False
Question: Boolean data type have only Yes or No value.
Correct Answer: True
Your Answer: False

Select The Blank
Question: The ________ loop is java's most fundamental looping statement.
Correct Answer: While
Your Answer: While

Multiple Choice Single Answer
Question: In multithreaded program each part of such program is called :-
Correct Answer: Thread
Your Answer: Thread

Multiple Choice Multiple Answer
Question: Which of the following are mathematical Expressions?
Correct Answer: (+ +) , (+ =) , (- =)
Your Answer: (+ =) , (- =)

True/False
Question: A thread can be blocked when waiting for a resource.
Correct Answer: True
Your Answer: True

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

Multiple Choice Single Answer
Question: Which statement has a the effect of "jumping out" of the switch statement?
Correct Answer: Break
Your Answer: Break

True/False
Question: As abstract class must have at least one abstract method and others may be concrete or abstract.
Correct Answer: True
Your Answer: True

Multiple Choice Single Answer
Question: The argument to which specifies the delayperiod in milliseconds
Correct Answer: sleep( )
Your Answer: sleep( )

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

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

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

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

Multiple Choice Single Answer
Question: Which cast must be used to cast an object to another class?
Correct Answer: Specific cast.
Your Answer: Explicit cast.

Multiple Choice Multiple Answer
Question: Which are keywords in Java?
Correct Answer: Extends , Synchronized , Sizeof
Your Answer: Extends , Synchronized , Sizeof

Multiple Choice Multiple Answer
Question: What are different data types in java?
Correct Answer: char , double , byte
Your Answer: char , double , byte

Match The Following
Question Correct Answer Your Answer
The Operators used in mathematical Arithmetic Operator (= operator;)
expressions
Order in which operators are Order of precedence Order of precedence
evaluated in expressions.
Whether an expression is evaluated Associativity Associativity
left-to-right or right-to-left
Java operator syntax for right (= operator;) Comparison Operator
associativity

Multiple Choice Single Answer
Question: Java uses which system to store packages?
Correct Answer: File system directories
Your Answer: File system directories

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

Multiple Choice Multiple Answer
Question: What are different modifiers?
Correct Answer: Private , Protected , Final
Your Answer: Private , Protected

Select The Blank
Question: After the new thread is created, it will not start running until you call its ________method.
Correct Answer: start( )
Your Answer: start( )

Select The Blank
Question: The ________ repeats a set of code at least once before the condition is tested.
Correct Answer: Do-while loop
Your Answer: Do-while loop

Select The Blank
Question: ________ loop repeats a statement or block while its controlling expressions is true.
Correct Answer: While
Your Answer: While

Match The Following
Question Correct Answer Your Answer
The data, or variable, defined Instance variable. Instance variable.
within a class
General form of Cast (target--type)value (target--type)value
Determine the relationship that Relational Operator Comparison operator
one operand has to the other
The secondary versions of the Short-Circuit Logical Operators Short-Circuit Logical Operators
Boolean AND and OR operators

Multiple Choice Multiple Answer
Question: The Bitwise Logical Operators are :-
Correct Answer: ^ , ^= , <<
Your Answer: ^ , <<

Select The Blank
Question: The name of the new thread is specified by ________.
Correct Answer: threadName
Your Answer: Currentthread

Select The Blank
Question: ________ is probably the least used java data type
Correct Answer: short
Your Answer: short

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 specifying index number

Multiple Choice Single Answer
Question: What is declared within the file that will belong to the specified pacakage?
Correct Answer: classes
Your Answer: classes

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

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

Select The Blank
Question: A class is ________ for an objects in java.
Correct Answer: Template
Your Answer: Template

Select The Blank
Question: Anonymous classes be implemented in an ________.
Correct Answer: Interface
Your Answer: Method

True/False
Question: When an object is referenced, it mean that it has been identified by the finalizer method for garbage collection.
Correct Answer: False
Your Answer: False

Multiple Choice Multiple Answer
Question: Features of Java applets are :-
Correct Answer: They can be transmitted over internet , Require java enabled web browser
Your Answer: They can be transmitted over internet , Require java enabled web browser , They are intelligent programs.

Multiple Choice Multiple Answer
Question: Classes usually consist of two things such as :-
Correct Answer: Instance variable , Methods
Your Answer: Instance variable , Methods

Multiple Choice Multiple Answer
Question: Main thread is important for which two reasons?
Correct Answer: It is thread from which other "child" thread will be swapped , Often it must be the last thread to finish execution because It performs various shutdown actions
Your Answer: It is thread from which other "child" thread will be swapped , Often it must be the last thread to finish execution because It performs various shutdown actions

True/False
Question: If the break statement is omited in switch statement, then execution will continue on into the next case.
Correct Answer: True
Your Answer: True

Multiple Choice Multiple Answer
Question: Which are the two threads of java?
Correct Answer: mainthread( ) , childthread( )
Your Answer: mainthread( ) , current

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

Multiple Choice Multiple Answer
Question: Which of these lines of code will compile?
Correct Answer: short s = 20; , char c = 32; , double d = 1.4;
Your Answer: short s = 20; , byte b = 128;

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: Packages , Subclasses

Multiple Choice Single Answer
Question: How is it possible to use few methods of an interface in a class?
Correct Answer: By declaring the class as abstract
Your Answer: By declaring the class as abstract

Multiple Choice Single Answer
Question: Which statement will always execute the body of a loop at least once?
Correct Answer: Do
Your Answer: Do

No comments:

Post a Comment