Sunteți pe pagina 1din 28

1) In OOP, the concept of insulating data and from direct access by the program is known as

a) b) c) d) Data hiding>> Inheritance Polymorphism Abstraction

2) Which of the following is NOT True with respect to OOP


a. b. c. d. Upgrading systems is difficult Multiple objects co-exists without any interference Secure Programs can be built Software development is made easy>>

3) What are Byte code instructions


a. b. c. d. It is Java Source Code It is code created by Java Compiler from the Source code>> It is machine code generated by interpreter It is executable code generated by the compiler

4) Which of the following HTML tag is used to communicate Java with a web page
a. b. c. d. HTML APPLET>> CODE HEAD

5) Which of the following is NOT one of the jump statements not available in Java
a. b. c. d. Goto>> break continue return

6) What should be the source filename of a Java file


a. b. c. d. Any name name matching any class name present in source file name matching the first class name in the source file name of the class containing the main method >>

7) What will be the output of the following code, if executed with command line arguments as follows javacmdline Java is wonderful classcmdline { public static void main(String args[) { for(inti=1;i<args.length;i++) { System.out.print(args[i); if(i!=args.length)

System.out.print( ); } System.out.println(); } }
a. b. c. d. Java Java is is wonderful>> cmdline Java is wonderful

8) Which of the following is the maximum absolute value for a signed intDatatype
a. b. c. d. 127>> 32768 32767 214748

9) What is FALSE with respect to variable in Java


a. b. c. d. A variable must be declared before it is used in the program A variable can be used to store any data type The place of declaration decides the scope of the variable A variable name must be maximum 10 characters long

10) What is the value of the expression Math.floor(1.567)


a. b. c. d. 1.6 1 2>> 1.5

11) What is the value of the expression 14-3*2/3


a. b. c. d. 1 12 >> 7 2

12) What is the value of result if the code of statements are executed int result = 42+45-48-5-15+20*2;
a. b. c. d. 59 >> 68 146 134

13) Which of the following is conditional operator available in Java


a. b. c. d. && ?: >> :: <

14) What line numbers will cause an error when you compile this code 1 2 class iftest {

3 4 5 6 7 8

public static void main(String args[) { inti=2; if(i=2) { System.out.println(Correct); } else

9 System.out.println(Incorrect); } 10 11
a. b. c. d.

} }
5,9,10 6,9 >> 6 9,10

15) Consider the following program code. state the output from it classifif { public static void main(String args[) { int x=3, y=1,z=5; if(x>y) { if (z<=y) { System.out.println(y is greater than z); } else { System.out.println(z is greater than y); } System.out.println(x is greater than y); } else { if(y>z) {

System.out.println(y is greater than z); } } } }


a) z is greater than y x is greater than y b) y is greater than z x is greater than y c) x is greater than y x is greater than z

d) x is greater than y>> z is greater than y>>

16) Which of the following looping constructs body, will execute at least once even if the condition is false.
a. b. c. d. for do while none of the above.>>

17) What will be the output of the following code segment int r=20; while(r>0) { r=r-10; if(r>0) continue; System.out.print("r is "+r); }
a. b. c. d. r is 10 r is 0>> r is 20 r is 20 r is 10

18) Variables whose values can never be changed are called as


a. static variables

b. Final variables c. object variables d. Abstract variables >>

19) What is NOT TRUE about static variable


a. b. c. d. There are created by giving keyword static. only one copy of static variable is created for all instances of class. It must be accessed using object of class >> These are referred to as class variables.

20) Consider the following class definition. Identify the error in the code class cube { private cube() { } intcalc(int s) { return s*s*s; } }; class sample { public static void main(String args[) { cube c=new cube(); intcb=c.calc(3); System.out.print(cb); } }
a. b. c. d. Default constructor cannot have access modifier private class sample is not public class cube is not public>> method calc not written completely

21) Which String method is used to compare 2 strings considering any case
a. b. c. d. Equals () >> equalto equalsIgnoreCase equalscase()

22) Which of the following is NOT a method of Vector class


a. b. c. d. addElement elementAt editElement>> insertElement

23) To create a package what is the first statement included?


a. b. c. d. import java.aw+.*; package >> public class

24) In the Interface definition what is TRUE for method declaration


e. a. b. c. List of methods declaration is only done>> Method declaration as well as body Only one Method declaration can be done Only one Methods body is allowed

25) What classes does the Java system package java.util contain
a. f. b. c. Classes for primitive types,Strings,Math functions, Threads and Exceptions Classes such as Vectors, hash tables, random numbers, date etc>> Classes for Input/Output support Classes for implementing graphical user interface

26) What does the following import statement actually mean import java.awt.*;
a. b. g. c. import awt class from the java package Import all variables from awt class Import all the classes from the awt package contained in the java package>> Import all the classes from the java package

27) In Multithreaded programming, which method is used to return the threads to

runnable state fromthe wait state


a. h. b. c. notify() resume()>> start() runnable()

28) In Java when a compile-time error occurs, then which file is NOT created
a) b) c) i. source .java .class .exe >>

29) In Java, when a run-time error occurs which of the following may happen
a. b. c. j. compiles successfully produces wrong output abnormal termination All of the above>>

30) Which exception may be thrown if the given code is executed giving 2 integer runtime arguments class sample { public static void main(String args[) { try

{ int a=Integer.parseInt(args[0); int b=Integer.parseInt(args); int c = a + b; System.out.println("Sum is "+c); } catch(ArithmeticExceptionae) { System.out.println("Arithmetic Exception "+ae.getMessage()); } catch(NumberFormatException ne) { System.out.println("Number Format Exception "+ne.getMessage()); } catch(Exception e) { System.out.println("Exception "+e); } } }
a. b. c. k. ArithmeticException NumberFormatException Exception None of the above>>

31) What does message passing involve in OOP


a. b. c. l. It involves specifying name of the object It involves name of the method It involves the information to be sent All of the options 1,2,3 >>

32) Which of the following is TRUE with respect to Dynamic Binding


a. m. b. c. Linking of a procedure call to the code to be executed in response to the call Code associated with a given procedure is not know until time of the call at run time>> It is associated with inheritance and polymorphism All of the options 1,2,3

33) JSL stands for


a. n. b. c. Java Source Linker Java Standard Library>> Just Source Library Java Standard Linker

34) JDK stands for


a. b. c. o. Java Display Kit Java Direct Kit Java Debugger Kit Java Development Kit>>

35) Which of the following type of Programs can be developed in Java


a. b. p. c. Standalone applications Web applets Both Option1and Option 2>> Neither Option1and Option 2

35) Which of the following is NOT the tokens available in Java language
a. b. q. c. Reserved keywords Operators Classes>> Separators

36) Which of the following is NOT a valid assignment statement


a. r. b. c. a=b=c=0; a='a'>> 0=b; c=72.25

37) Which of the following operator is used to access the instance variables and methods of class objets
a) b) c) s. . : :: instanceOf>>

38) What will be the value of b if a=2 and given the expression b=a++;
a. b. c. t. 0 1 2 3>>

39) What is the value of ans if the code of statements are executed inti = 42+45-48-5; int j = 5+5-8+2; intans = i%j;
u. a. b. c. 2 8 34 12 >>

40) Which of the following statements do not fall in selection statement category
a. b. v. c. if statement switch statement conditional operator statement>> for construct statement

41) What will be the output of the following code segment inta,b; a=2; b=5;

if(a>2) if(b>2) { System.out.print(b is +b); } else System.out.print(a is +a);


a. b. c. w. a is 2 b is 5 a is 2 followed by b is 5 No output >>

42) Which of the following form of Inheritance has one super class and many subclasses.
a. b. x. c. Single Inheritance Multilevel Inheritance Hierarchical Inheritance>> Multiple Inheritance

43) When default keyword is used a member of a class, how is the visiblility of the member
a. It is visible everywhere b. It is visible everywhere in the current package and also subclasses in other packages y. It is visible everywhere in the current package only>>

c. It is visible only in its own class 44) What is wrong in the following code
abstract class print { abstract show(); } class display extends print { } a. z. b. c. Nothing is wrong Method show() should have a return type>> Method show() is not implemented in class display class display does not contain anything

45) The method removeElement(argument) is a method used with


a. b. c. d. Arrays>> Strings StringBuffers Vectors>>

46) What statement would better explain what are wrapper classes
aa. Wrapper classes convert primitive datatypes into object types>> a. Wrapper classes convert objects to primitive data types

b. Wrapper classes are used to store list of objects that may vary in size c. Wrapper classes are used to convert any class type into array type object

47) What is valid statement to import only the class color from the awt package contained in the javapackage
a. awt.java.*; b. awt.java.color; bb. java.awt.color; >> c. java.awt.*;

48) The following statements create what type of inheritance if class B and class C are Base classes class A extends B extends C
{ } a. b. cc. c. Single Inheritance Multilevel Inheritance Multiple Inheritance >> Hierarchical Inheritance

49) Which of the following step is invalid for creating a package


a. Declare the package in beginning of the file b. Define the classes to be put in the package & declare it public c. Create the listing as java in the Subdirectory by package menu dd. Execute this java file>>

50) In Multithreaded programming, which method is to be implemented when thread are created by implementing the 'Runnable' interface
ee. a. b. c. start()>> run() init() stop()

51) In, Java Exception handling code how many catch statements can a try have
a. b. c. ff. none one two one or more>>

52) In Java, which Exception type is caused when an applet tries to perform an action not

allowed by thebrowsers security setting


a. b. gg. c. ObjectOutOfBoundsException OutOfMemoryException BrowserAccessException>> SecurityException

53) What are user define data types and behave like built-in types of a programming language.
a) Objects

b) Methods c) Templates hh. Classes>>

54) In OOP, the concept of wrapping data and methods into a single unit called classes is

known as
a. Data Abstraction b. Inheritance c. Polymorphism ii. Encapsulation>>

55) In OOP, the concept of Inheritance provides us with


a. Insulation jj. Linking >> b. Reusability c. Sharing 56) In OOP process by which objects of one class acquire the properties of objects of

anotherclass is
kk. Inheritance >> a. Polymorphism b. Encapsulation c. Abstraction

57) In OOP the concept of representing essential features without including the background details is called as
a. Data Hiding ll. Data Abstraction >> b. Inheritance c. Dynamic Binding

58) Dynamic binding is associated with


mm. Polymorphism>> a. Inheritance b. Both Option1 and Option2 c. Neither Option1 and Option2

59) In OOP approach programs are divided into


a. Objects b. Methods nn. Functions >> c. Procedures

60) In OOP program objects communicate with each other through


a. Data b. Methods c. Classes oo. Objects>>

61) Which of the following is NOT one of the programming techniques.


a. Structured programming pp. Modular programming >>

b. Bottom-up programming c. Destructred programming

62) In OOP, the concept of Polymorphism is


a. Reusability qq. Ability to take more than one form >> b. Sharing of data c. Hiding of data

63) OOP treats what as a critical element in program development and does not allow it to flow freely around the system.
a. Procedures b. Action c. Data rr. Method>>

64) Which of the following type of applications OOP can be useful for
ss. Real-time Systems >> a. Simulation and modelling b. Decision Support and office automation systems c. All of the options 1,2,3

65) Which of the following C++ feature is NOT included in Java


a. Multilevel inheritance tt. Inner classes >> b. Multithreading c. Operator overloading

66) Which of the following tools is NOT a part of JDK (Java Development Kit)
uu. appletviewer ( for viewing applets) >> a. javac ( java compiler) b. javac ( java compiler) c. classes and methods

67) What is HotJava


vv. It is first program written in Java and is web browser >> a. It is applet to run a browser b. It is network application to run applets c. It is program that can edit applets

68) Java is Distributed-language, What statement explain this feature


a. Java programs can be easily moved from one computer system to another b. Java systems verify memory access and virus Java can be used to create applications on the networks >> c. It provides many safeguards to ensure reliable code

ww.

69) Java is Multithreaded Language, What Statement best explains this feature
a. Java application need not wait for the application to finish one task before beginning another >> b. Java is capable of dynamically linking in U class libraries, methods and objects c. Java supports functions written in other languages such as C and C++ d. Java uses less amount of memory in environment

70) API stands for


a. b. c. d. Applet Program Internet Application Package Information Abstract Programming Interface Application Programming Interface>>

71) What does JVM stands for


a. b. c. d. Java Virtual Machine>> Java Visual Memory Jar Visual Monitoring Java Virtual Management

72) What is the function of Java Disassembler


a. b. c. d. Machine code can be converted into compiled code>> Compiled code can be converted into machine code Source code can be converted into compiled code Compiled code can be converted into source code

73) Which of the following feature of C++ is NOT supported by Java and is

thereforeimplementedusing interfaces
a. Nested Classes b. Inner Classes>> c. Polymorphism

74) Java is also popularly known as


a. b. c. d. Web browser Applet language Internet language Object language>>

75) Java is ----- Language.


a. b. c. d. Compiled Interpreted Both Compiled and interpreted >> Byte Code

76) Java is Extensible Language,what statement explain this feature


a. Java application need not wait for the application to finish one task before gegining another b. Java is capable of dynamically linking in u class libraries methods and subjects>> c. Java supports functions written in other languages such as c and c++ d. Java uses less amount of memory in environment

77) Java is Platform-independent,what statement explain this feature


a. b. c. d. Java programs can be easily moved from one computer to another >> Java systems verify memory access and virous Java can be used to create applications on the networks>> It provides many safeguards to ensure reliable code

78) To create a package what is the first statement included?


a) b) c) d) import java.aw+.*; package >> public class

79) What classes does the Java system package java.awt contain
a) b) c) d) Classes for primitive types,Strings,Math functions, Threads and Exceptions Classes such as Vectors, hash tables, random numbers, date etc Classes for Input/Output support Classes for implementing graphical user interface >>

80) Which of the following step is invalid for creating a package


a) b) c) d) Declare the package in beginning of the file Define the classes to be put in the package & declare it public Create the listing as java in the Subdirectory by package menu Execute this java file >>

81) In Multithreaded programming, what is the constant numeric value used for setting lowestpriority for Threads a) 1>> b) 5 c) 4 d) 10

82) In Java, which Exception type is caused by failure of conversion between strings and numbers
a) b) c) d) StringIndexOutOfBoundsException InvalidConversionException InvalidAccessException NumberFormatException>>

83) Which of the following is valid rule to create Java Identifier names
a) b) c) d) It can contain digits, alphabets, dollar symbol and underscore >> It cannot start with a underscore It cannot contain uppercase letter It can start with a digit

84) Which of the following is NOT one of the Iteration statements available in Java
a) b) c) d) for if >> do while

85) What is the process of assigning a smaller type to a larger one with respect to type
a) b) c) d) casting Promotion narrowing implicit>>

86) Which of the following operators have lowest precedence


a) b) c) d) unary operators binary operators bitwise operators >> Or logical operators>>

87) If the variable i& j are of type int, What is the value of j if j=i/2
a) b) c) d) 0.5 0.2 0 >> 1

88) Which of the following is NOT True with respect to if & switch branching statement
a) b) c) d) In nested if Statement the last else gets associated with the first if statement A switch expression can be of any data type >> Program terminates execution on switch with a break statement all of the above

89) Which of the following is NOT one of the looping constructs available in Java
a) b) c) d) switch while do for >>

90) Which of the following is NOT one of the different forms of Inheritance
Single Inheritance Simple Inheritance >> Multilenceijnheritance>> Hierarchical Inheritance

91) Which of the following visibility modifiers allows widest visibility and is accesible everywhere
a) b) c) d) private Protected Public >> Friendly

92) What does the following method do? Integer.parseInt(arg)


a) b) c) d) converts primitive Int to wrapper class converts integer to small integer type converts string to primitive integer>> converts string object to wrapper Int

93) What of the following String methods is used to join two strings
a) b) c) d) join concat>> concate concatenation

94) What is process of converting one data type to another


a. b. c. d. Converting Changing Defining Casting / type casting>>

95) What type of value will the expression (a%b) return where, a=10 and b=7.
a. b. c. d. 7 1 Int>> float

96) What is the value of expression a<b?a++;++b if the value of a is 1 & b is 2 //


a. b. c. d. 1>> 2 3>> None of these>>

97) What will be the output of the following program code


class max { public static void main(String args[]) { int max=10; max(max,10,20); System.out.print(max); } static void max(intmax,int x1,int x2) { if(x1>x2) max=x1; else max=x2; } } a. 10>> b. 20 c. 30 d. 0

98) Identify line numbers where logical errors occur in the following code so that factorial of 5 is calculated.
1 class factorial 2{ 3 public static void main(String args[]) 4{ 5 int n=0,fact=0; 6 for(int n=0;n>=1;n--) 7 fact=fact*1; 8 System.out.println(Factorial of 5 is +fact); 9} 10 } a. lines 5,6 b. lines 6 c. lines 7 d. lines 5,6,7>>

a) What is valid for abstract classes and abstract methods


a. b. c. d. We cannot use abstract classes to instantiate objects.>> abstract methods of an abstract class must be defined in its subclass>>. Constructers cannot be declared abstract >> All of the above >>> *

99) Which of the following is an valid statement with shorhand operator //


a. b. c. d. a1/=1 a*=1 a%=1 All of the above>

100)

What is the error in the following class definition

abstract class sample { abstractcalc(int a) { } }

a) b) c) d)

class header is not defined properly constructor is not defined methodcalc is not defined properly // No error>>

101) Java does not support Multiple Inheritance. What is an alternative approach provided to implement this
a. b. c. d. Packages Interfaces>> Collections Wrapper classes

102)
a. b. c. d.

What statement is used to include classes from packages

include import SA>> extend interface

103) a. b. c. d.

In Multithreaded programming, when a thread is ready for execution and is waiting for the availability of the processor, it is said to be in what state
running newborn runnable >> blocked

104)
a. b. c. d.

In Java, which Exception type is caused by math errors

ArithmeticException>> ArrayStoreException NumberFormatException IOException

105)
a. b. c. d.

Which of the following is NOT a Java keyword

Throws>> try while>> or Exception

106)
a. b. c. d.

Which of the following is NOT true with respect to Java Program Structure

Comments can be given only at the beginning of Program>> Package statement should be before class definition Import statement should be before class definition Interface statement should be before class definition

107)
a. b. c. d.

Which of the following are Integer types in Java

Byte Long>> Short All of the options 1,2,3

108) Which of the following is NOT one of the valid escape sequence available for use in Java
a. b. c. d. \b \n \m>> \t

109)
a. b. c. d. 1.6 1 2>> 1.5

What is the value of Math.ceil(1.567)

110)

What will be the output of the following code segment

n=5; r=n%3; if (r == 0) System.out.println(zero); else if (r ==1) System.out.println(one); else if (r == 2) System.out.println(two); else System.out.println(three); a. zero
b. one c. two >> d. Three

111)

What will be the output of the following code segment

i=11; sum=0; do { sum=sum+i; i=i+1; }while(i<=10); System.out.println(i); a. 1 b. 10 c. 11 d. 12>>

112)
a. b. c. d.

Which of the statement is invaild with respect to finalizer method.

They are used to initialize objects They are used to free certain resources They can be added to any class Java calls this method whenever it is about to reclaim space for that objects >>

113)
a. b. c. d.

Methods that can never be altered in any way are called as

static methods abstract methods >> Member methods Final methods

114) What will be displayed as output if S1 contains word "Java" with method S1.indexOf('a') //
a. 4 b. 2

c. 1>> d. 3

115)
a. b. c. d.

What form of Inheritance is not supported by Java

Single Multilevel Multiple>> Hierarchical

116)
a. b. c. d.

What does the following import statement actually mean import java.awt.*;

import awt class from the java package Import all variables from awt class Import all the classes from the awt package contained in the java package>> Import all the classes from the java package

117) In Java, which Exception type is caused when there's not enough memory to allocate a new object
a. b. c. d. NullPointerException ObjectOutOfBoundsException OutOfMemoryException>> IOException

118)
a. b. c. d.

In Java, which Exception type is caused by math errors

ArithmeticException>> ArrayStoreException NumberFormatException IOException

119)
a. b. c. d.

Which of the following is invalid in case of standard default values of variables


a or c

byte has a default value of 0>> int has a default value of 0>> float has a default value of 0 boolean has a default value of 0

120)
a. b. c. d.

Which of the following is a non-primitive Data type in Java

Integer Arrays>> Character Boolean

121)
a. b. c. d. -6 >> 2 -4 2.5

What is the value of the expression 6-(3+2)*5/2

122)

What will be the output of the following program code

class max { public static void main(String args[]) { int max=10; max(max,10,20); System.out.print(max); } static void max(intmax,int x1,int x2) {

if(x1>x2) max=x1; else max=x2; } } a. 10 >> b. 20 c. 30 d. 0

123)
for( ) for( ) if(condition) break; a. b. c. d.

Given the following code segment, what will happen when break is executed

It will terminate the program It will exit from the if >> It will exit from inner for loop It will exit from outer for loop

124)

What is the use of the super() method//

a. It is used only with a subclass constructor. b. The call to this method must be the first statement within the subclass constructor c. The parameters of the super method must match the order and type of the instance variables declared in the superclass d. All of the Above>>

125)
a. b. c. d.

Which of the following form of Inheritance has several super classes.

Single Inheritance Multilevel Inheritance Hierarchical Inheritance Multiple Inheritance>>

126) [51] What will be displayed as output if S1 contains word "Java" with method S1.replace('a','c')
a. b. c. d. va Jcvc>> Jcva Av

127)
a. b. c. d.

[52]

Which of the following string created is a NULL terminated.//

String created using array of characters String created using instance of String class . String created using instance of StringBuffer class.>> All of the above

128)
a. b. c. d.

Variables defined in Interfaces are by default

Final>> static Both 1 & 2 Neither 1 nor 2

129)

What statement is used to include classes from packages

a. include b. import>> c. extend

d. Interface

130) In Multithreaded programming, what is the constant numeric value used for setting highest priority for Threads
a. b. c. d. 1 5 4 10>>

131) When a run-time error occurs in Java, what happens while execution of the program
a. b. c. d. displays an error and continues further execution of the program displays an error message and abnormally terminates the execution of the program>> executes the program generating output displays compile-time errors in the program

132)
a. b. c. d.

In Java, what is a condition that is caused by a run-time error in the program

validity exception >> error Action

133)
a. b. c. d.

In, Java user-defined Exceptions can be created using keyword

Throw >> Throws Thrown Catch

134)
a. b. c. d.

In Java, what segment of code is is used for error handling

Detecting and throwing Execptions Catching Exceptions>> Taking appriopriate actions All of the above>> or

135)
a. b. c. d.

When we implement the runnable interface we must define the method

start() init() run() >> runnable()

136)
a. b. c. d.

What can interfaces contain?

Methods>> Variables classes Both 1 & 2

137) What will be displayed as output if S1 contains word "Java" with method S1.indexOf('a',3)
a. b. c. d. 4 2>> 1 3

138)

How is it possible to make it compulsory that a method is redefined in a subclass

a. By making a class private b. By making a class abstract c. By making the class final

d. By making the class virtual>>

139) When default keyword is used a member of a class, how is the visiblility of the member
a. b. c. d. It is visible everywhere It is visible everywhere in the current package and also subclasses in other packages It is visible everywhere in the current package only It is visible only in its own class>>

140)
a. b. c. d.

Which of the following portion specified in the for loop is compulsary

Initialization test condition>> Increment All of the above>> its only for FOR LOOP

141)

What line numbers will cause an error when you compile this code// 6,7,12

1 class chknum 2 { 3 public static void main(String args[]) 4 { 5 int n=3; 6 switch(n); 7{ 8 case 0 :System.out.print(No is 0); 9 case 1 :System.out.print(No is 1); 10 case 2 :System.out.print(No is 2); 11 case 3 :System.out.print(No is 3); 12 case 3 :System.out.print(Other Number);break; 13 } } } a. b. c. d. Lines 3,7,8,9,10,11 Lines 6,8,9,10,11,12>> Lines 7,10,11 Lines 11,12

142)

Which of the following is True with respect to branching statements if & switch

a. every if statement can be written using switch>> b. every case must end with a break statement c. every case label follows with a(:) colon--------------

143)
a. b. c. d. 1>> -1 0 11

What is the value of the expression abs(1)//

144)
a. b. c. d.

How many arguments does the pow math function require

0 1 2 >> or more 3

145)

What is process of converting one data type to another

a. Converting b. Changing c. Defining

d. Casting >>

146) To print string on the screen we use System.out.println. What is the correct explaination for this
a. b. c. d. System is a class.println is a method and out is a object >> System is a Object.out is a object and println is data member System is a package out is a method print is a object System is a pointer to object out of class println

147)
a. b. c. d.

In, Java Exception handling code what could be done in the finally block

It is used to write initialization code It can be used to perform house-keeping operations It can be used to catch all exceptions It can be used to ignore all exceptions>>

148) In Multithreaded programming, which of the following method is used to change the priority of a Thread
a. b. c. d. changePrior() setPrior() setPriority()>> ThreadPrior()

149)
a. b. c. d.

Which of the following is possible using Vector class//

It is used to store objects It can store objects that may vary in size It is possible to add & delete All of Three>>

150)
a. b. c. d.

The concept of inheritance is implemented in Java by

creating more than one class extending two or more classes SA>> extending one class and implementing one or more interfaces importing classes from packages

151) Which of the following keywords cannot be used to control access to a class member
a. b. c. d. Interface Abstract>> Public Protected

152)

What will be the output of the following code segment

n=5; r=n%3; if (r == 0) System.out.println(zero); else if (r ==1) System.out.println(one); else if (r == 2) System.out.println(two); else System.out.println(three);

a. b. c. d.

zero One Two>> Three

153)
a. b. c. d.

In the switch statement the constant expression that is checked can be of type

Character>> float Byte Short

154) a. b. c. d.

An expression having variables of type byte,short,int and long then what type of the variable will be the resultvariable
int long Short Byte >>

155)
a. b. c. d.

Which of the following is a primitive Data type in Java

Character>> Classes Arrays Interface

156)
a. b. c. d.

Which of the following is NOT a valid documentation comment used in Java

// \\ /* */ /** */>>

157)
a. b. c. d.

Which of the following feature in C is NOT included in Java

Break statement Continue statement Pointer type>> Primitive data types

158)

Identify line numbers where errors occur in the following code

1 class sample 2{ 3 public static void main(String[], args[])>> 4{ 5 System.out.println(Hello); 6} 7 }; a. Lines 3,7 >> b. Line 3 c. Line 7 d. Line 5

159)

Identify line numbers where errors occur in the following code 1,3,6,8

1 Class sample 2{ 3 public static void main(string args[]) 4{ 5 int m=10; 6{

7 int m=20; 8} 9} 10 } a. Lines 1,3,7 b. Line 3,5,7>> c. Line 5,7 d. Line 3,5

>>

160)

Identify line numbers where compile errors occur in the following code

1 class sample 2{ 3 public static void display() 4{ 5 byte x=212; 6 float f=100.12; 7 System.out.println("Value of f="+f); 8 System.out.println("Value of x="+x); 9} 10 } a. Lines 5,6,7,8 b. Line 5,6>> c. Line 7,8 d. Line 5,6

161)
int m = 100; int n =103;

What will be the output of the following code segment

while(++m<=--n); { System.out.print(m); } a. b. c. d. 102>> 101 103 100

162)

What will be happen when the following code is executed.

class check { public static void main(String args[]) { int m; System.out.print(m is +m); } } a. Run-time error b. Compile-time error>> c. m is 0 d. No output

163)

What will be the output of the following code, if executed with command line arguments as follows
javacmdline Java is wonderful classcmdline { public static void main(String args[]) { System.out.println(Number of arguments : +args.length); for(inti=0;i<args.length;i++) System.out.print(args[i]+ ); } }

a) Number of arguments : 4 Java is wonderful b) 4 cmdline Java is wonderful c) Number of arguments : 3 Java is wonderful d) cmdline Java is wonderful

164)
8 20>> 14 0

What is the result if the code of statements are executed

int result = (2*(5-8)*(5-5)+10)*2;

165)

What is the output of the following program code

class check { public static void main(String args[]) { boolean b=true; if(b) System.out.println("False"); System.out.println("True"); return; } } a. True b. False c. False True>> d. Error

166)

class sample

{ public static void main(String args []) { int x=10;

int y=15; system.out.print(x>y?4:3) } } a) b) c) d) 3>> 4 10 15

167)

What is the result if the code of statements are executed classswtest { public static void main(String args[]) { char ch=i; switch(ch) { case a : case e : case i : System.out.println(It is a vowel); case o : case u : System.out.println(It is a vowel);break; default :System.out.println(It is a consonant); } } }
a)No output b) It is a vowel c)It is a consonant d) It is a vowel>>

168)

What will be the output of the following code segment

int r=100; while(true) { if(r<10) break; r=r-10; } System.out.print(r is +r);


a) b) c) d) r is 0 >> r is 10 r is 100 r is -10

169)
a. b. c. d.

[20]

Java is a _________ Language

Compiled Interpreted Both Compiled and Interpreted>> Byte Code

170)

Java is Platform-independent, What statement explain this feature

a. Java programs can be easily moved from one computer system to another>>

b. Java systems verify memory access and virus c. Java can be used to create applications on the networks d. It provides many safeguards to ensure reliable code

171)
a. b. c. d.

Java is Robust, What statement explain this feature

Java programs can be easily moved from one computer system to another Java systems verify memory access and virus Java can be used to create applications on the networks It provides many safeguards to ensure reliable code>>

172)
a. b. c. d.

What was Java originally called as

Object C Object Basic Oak>> Pascal

S-ar putea să vă placă și