Вы находитесь на странице: 1из 3

P34 – JAVA

java smallprog
1 Which is not Buzzword of java java SmallProg.java
Architect neutral
Roubst 9 Which of the following is not legal identifier
Multithreading a2z
Overloading odipus
52pick
2 What is the correct declaration of main() ca$h
public static void main(String args[])
public void main(String args[]) 10 default value for boolean is
static void main(String args[]) false
public static int main(String args[]) true
0
3 Static Method means , which belongs to the class and not 1
to any object of class
False 11 default value of object reference
True null
Garbage value
4 class A 0
{ -1
int value1;
} 12 (>>>) this operator is known as
class B extends A{ Shift left
int value2; Shift right with sign bit
} Shift right with right zero fill
Select all valid answers Shift left with sign bit
A)Class A extends class B
B)Class B is the superclass of Class A 13 What is the value of result in following code segment
C)Class A is the superclass of Class B int I=12;
D)Class B is a Subclass of class A int result = I>>2
A 2
B 3
C 4
D 6

5 An instance member is 14 Which of the following is not operator in java


also called a static member <<<
is always a variable &
is never a method %=
belongs to a single instance not to class as whole >>> ans

6 How do objects pass messages in java 15 identifiers in java are case sensitive
by modifying each other's member variables True
by modifying the static member variables of each other's False
classes
by calling instance member methods 16 In parameter passing Which Group of statements are true
calling static member methods of each other's class A)
Primitive datatypes Value passed--data value Class Type
7 An object is Value passed--Reference value
what classes are instantiated from Array Type Value passed--Reference value
an instance of a class B)
a reference to an attribute Primitive datatypes Value passed--data value Class Type
a variable Value passed-data value
Array Type Value passed--Reference value
8 What Command is used to run the following program C)
// filename smallprog.java Primitive datatypes Value passed--Reference value Class
public class smallprog Type Value passed--Reference value
{ Array Type Value passed--Reference value
public static void main(String args[]) D)
{ Primitive datatypes Value passed--data v A
System.out.println("Best Luck";); B
} C
} D
java SmallProg
javac SmallProg
17 What is true about final keyword True
to define constant variables False
To prevent inheritance of class from the class
which is defined final 28 An Interface can be extended from more than one
final method cannot be overriden interface
final and abstract can not be used sumultaneously True
False
18 What are the true statements about access specifiers
public -Accessible everywhere 29 In System.out.println
protected --Accessible by any class in the same package as out is object
its class and accessible only by subclasses of its class in out is class
other packages out is inner class
private--accessible in its own class out is a method
default--onlu accessible by classes,including subclasses in
the same package 30 The system.gc() methos can be used to force garbage
collection
19 What statements are true about abstract methods True
abstract methos does not have implementation False
class should be declared as abstract class
class should be declared as final class 31 Which of the following method to start a new thread
a final method can be abstract start()
begin()
20 In multithreading programming if you want that one run()
thread at a time can execute the method then declare that resume()
method as
synchronized 32 When extending the thread class to provide a thread's
native behavior,which methodsshould be overridden?
synchronize begin()
synchronizable start()
run()
21 Native methods are also be called as foregin methods resume()
True
False 33 What is the output of following code segments

22 Which of the following modifiers are used with variable String motto="Program once";
static motto = motto+",execute everywhere.";
volatile motto.concat("Don't be let!");
transient Program once ,execute everywhere.Don't be let!
native "Program once ,execute everywhere.Don't be let!"
Program once .Don't be let!
23 All exceptions are derived from the Program once ,execute everywhere.
java.lang.Throwable
java.lang.Error 34 What is the value of ids in following code segment
java.lang.Exception String funstr ="java jives";
java.lang.io int idx = funstr.indexOf('J');
0
24 A try block must be followed by either at least one catch 5
block or one finally block 1
true 6
false
35 Which of the following method is used to set text in
25 To invoke methos of superclass in subclass which textfield
following keyword is used SetText("text to set");
base setText("text to set");
super PutText("text to set");
Super putText("text to set");
Sub
36 which is the default layout for panel,Applet class
26 Subclasses must defines all methods that the superclass GridLayout
defines BorderLayout
True FlowLayout
False CardLayout

27 To call a constructor of immediate superclass super() 37 To arrange 16 buttons in tabular form which layout is
should be first statement in constructor of subclass used
BorderLayout
GridLayout {
FlowLayout int I=0;
CardLayout switch(I)
{
38 To implement Radio buttons, checkbox can be case 0:
incorpated with _________________ System.out.println("output is zero");
CheckboxGroup case 1:
CheckGroup System.out.println("output is one");
OptionGroup case 2:
boxGroup System.out.println("output is two");
break;
39 What command is used to select item in the list at given default:
index System.out.println("output is default");
select }
setselect }
choose } output is zero
listselect output is one
output is zero
40 Which of the following classes are subclasses of the output is one
component class? output is two
A) List output is zero
B)Applet output is zero
C)CheckboxGroup output is two
D)MenuItem
A 47 Which statement is correct
B <applet code="one.class" width=70 height=20>
C </applet>
D <applet code="one" width=70 height=20>
</applet>
41 Which class is superclass of all menu related classes. <applet width=70 height=20>
MenuBar </applet>
MenuComponent <applet code="one.class" width=70 height=20>
MenuPanel
MainMenu 48 Which one of the following classes represents a top-level
window with a title and border decorations
42 To add a separator which of the following function is Container
used Panel
addSeparator() Window
setSeparator() Frame
putSeparator()
AddSeparator() 49 Which of these methods can be used to manipulate the
bounds of a component object
43 What function is used to set menu for a frame setSize()
having MenuBar name foodBar SetDementions()
setMenuBar(foodBar) setBounds()
addMenuBar(foodBar) setLocation
setBar(foodBar)
setMenu(foodBar) 50 public class Myclass extends Frame
{
44 Which function is used to return the object that //some code
originated the event setVisible(true)//line 1
getObject }
getControl line 1 is required
getSource line 1 is mandatory
getComponent at line 1 is compile time error will be displayed
at line 1 is Runtime error will occour
45 Which of the following component generates
AdjustmentEvent
MenuItem
Label
Text
ScrollBar

46 public class advice


{
public static void main(String args[])

Вам также может понравиться