Thursday, 22 August 2013

Java Programming - 17

LIST OF ATTEMPTED QUESTIONS AND ANSWERS

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

Select The Blank
Question: ________ are stored in hierarchical manner.
Correct Answer: Packages
Your Answer: Objects

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

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

Multiple Choice Single Answer
Question: Which statement defines a name space in which classes are stored?
Correct Answer: package
Your Answer: class

Select The Blank
Question: Threads define several ________.
Correct Answer: constructors
Your Answer: constructors

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

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

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

True/False
Question: Boolean values can be cast into any other primitive type.
Correct Answer: False
Your Answer: False

True/False
Question: Short data type range is -30,376 to 32768.
Correct Answer: False
Your Answer: True

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

Select The Blank
Question: In ________ statement condition is true, then statement 1 is executed.
Correct Answer: If
Your Answer: If

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 , They require web server for their operation , Require java enabled web browser

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

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

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

Select The Blank
Question: The most commonly used ________eger type is int.
Correct Answer: int
Your Answer: int

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

True/False
Question: User-defined package can also be imported just like the standard packages.
Correct Answer: True
Your Answer: True

Multiple Choice Multiple Answer
Question: Java defines two ways when instantiating an object, such as :-
Correct Answer: Can implement the runnable interface , Can extend the thread class
Your Answer: Can extend the thread class , Class object

Multiple Choice Single Answer
Question: Which method is used to determine the class of an object?
Correct Answer: getClass( ) method
Your Answer: getClass( ) method

Multiple Choice Single Answer
Question: If you do not implement all the methods of an interface while implementing, what specifier should you use for the class ?
Correct Answer: abtract
Your Answer: abtract

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 , It is main thread

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

Select The Blank
Question: A class can only inherit a single ________.
Correct Answer: Superclass
Your Answer: Superclass

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: byte b = 128; , char c = 32;

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

Multiple Choice Single Answer
Question: Syntax to declare a variable in java is :-
Correct Answer: type identifier [=value][,identifier[=value]…]
Your Answer: type identifier [=value][,identifier[=value]…]

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.packagename.classname

True/False
Question: Do while loop always executes its body at least once, because its conditional _expression is at the bottom of the loop.
Correct Answer: True
Your Answer: True

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: Loop

Multiple Choice Multiple Answer
Question: Within what Java provides many levels of protection to allow control over the visiblity of variables and methods?
Correct Answer: Classes , Subclasses , Packages
Your Answer: Classes , Subclasses , Packages

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

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

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

Multiple Choice Multiple Answer
Question: Which is a public static member of thread?
Correct Answer: currenthread( ) , mainthread( )
Your Answer: mainthread( ) , Staticthread( )

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

Select The Blank
Question: ________ are stored in hierarchical manner.
Correct Answer: Packages
Your Answer: Objects

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

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

Multiple Choice Single Answer
Question: Which statement defines a name space in which classes are stored?
Correct Answer: package
Your Answer: class

Select The Blank
Question: Threads define several ________.
Correct Answer: constructors
Your Answer: constructors

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

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

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

True/False
Question: Boolean values can be cast into any other primitive type.
Correct Answer: False
Your Answer: False

True/False
Question: Short data type range is -30,376 to 32768.
Correct Answer: False
Your Answer: True

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

Select The Blank
Question: In ________ statement condition is true, then statement 1 is executed.
Correct Answer: If
Your Answer: If

Match The Following
Question Correct Answer Your Answer
Derived class Subclass of protection Subclass of protection
Class Interface Directories
Packages Directories Interface
Specifier Protected Excpetion

Multiple Choice Multiple Answer
Question: _Expression must be of the data types :-
Correct Answer: Byte , Short , Int
Your Answer: Byte , Short , Int

Multiple Choice Single Answer
Question: What is an array?
Correct Answer: It is value collection of same type of data type
Your Answer: It is value collection of same type of data type

Multiple Choice Single Answer
Question: Which Control Statements allow the program to choose different paths of execution?
Correct Answer: Selection
Your Answer: Selection

Select The Blank
Question: ________ is referred by a variable candidate for garbage collection when the variable goes out of scope.
Correct Answer: Objects
Your Answer: Methods

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

True/False
Question: Threads of equal priority must voluntarily yield control to their peers.
Correct Answer: True
Your Answer: True

Multiple Choice Single Answer
Question: How multidimensional array is declared?
Correct Answer: int[4] [5];
Your Answer: char[4,5]

Select The Blank
Question: ________ method suspends a thread for some period of time.
Correct Answer: sleep( )
Your Answer: sleep( )

True/False
Question: Suppose a given instance variable has been declared private, this instance variable is manipulated by methods outside its class.
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 , They require web server for their operation , Require java enabled web browser

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

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

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

Select The Blank
Question: The most commonly used ________eger type is int.
Correct Answer: int
Your Answer: int

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

True/False
Question: User-defined package can also be imported just like the standard packages.
Correct Answer: True
Your Answer: True

Multiple Choice Multiple Answer
Question: Java defines two ways when instantiating an object, such as :-
Correct Answer: Can implement the runnable interface , Can extend the thread class
Your Answer: Can extend the thread class , Class object

Multiple Choice Single Answer
Question: Which method is used to determine the class of an object?
Correct Answer: getClass( ) method
Your Answer: getClass( ) method

Multiple Choice Single Answer
Question: If you do not implement all the methods of an interface while implementing, what specifier should you use for the class ?
Correct Answer: abtract
Your Answer: abtract

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 , It is main thread

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

Select The Blank
Question: A class can only inherit a single ________.
Correct Answer: Superclass
Your Answer: Superclass

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: byte b = 128; , char c = 32;

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

Multiple Choice Single Answer
Question: Syntax to declare a variable in java is :-
Correct Answer: type identifier [=value][,identifier[=value]…]
Your Answer: type identifier [=value][,identifier[=value]…]

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.packagename.classname

True/False
Question: Do while loop always executes its body at least once, because its conditional _expression is at the bottom of the loop.
Correct Answer: True
Your Answer: True

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: Loop

Multiple Choice Multiple Answer
Question: Within what Java provides many levels of protection to allow control over the visiblity of variables and methods?
Correct Answer: Classes , Subclasses , Packages
Your Answer: Classes , Subclasses , Packages

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

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

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

Multiple Choice Multiple Answer
Question: Which is a public static member of thread?
Correct Answer: currenthread( ) , mainthread( )
Your Answer: mainthread( ) , Staticthread( )

No comments:

Post a Comment