1. Which one of the following
is true for Java
A) Java is object-oriented and interpreted
B) Java is efficient and faster than C
C) Java is the choice of everyone.
D) Java is not robust.
Ans-A
2. The command javac is used to
A) debug a java program
B) compile a java program
C) interpret a java program
D) execute a java program
Ans-B
3. Which is the root class of
all AWT events
A) java.awt.ActionEvent
B) java.awt.AWTEvent
C) java.awt.event.AWTEvent
D) java.awt.event.Event
Ans-B
4. OOP features are
i) Increasing productivity ii) Reusability
iii) Decreasing maintenance cost iv) High vulnerability
A) 1,2 & 4
B) 1,2 & 3
C) 1, 2 & 4
D) only 1
Ans-B
5. break statement is used to
i) get out of method ii) end a program
iii) get out of a loop iv) get out of the system
A) 1 & 2
B) 1,2 & 3
C) 1 & 3
D) 3
Ans D
6. Native-protocol pure Java
converts ……….. into the ………… used by DBMSs directly.
A) JDBC calls, network protocol
B) ODBC class, network protocol
C) ODBC class, user call
D) JDBC calls, user call
Ans-A
7. Which of
the following is true about Java.
A) Java does not support overloading.
B) Java has replaced the destructor function of
C++
C) There are no header files in Java.
D) Java Support overriding
A.only A
B.only B
C.A,B,C
D.only D
Ans-.C
8. ……………. are not machine
instructions and therefore, Java interpreter generates machine code that can be
directly executed by the machine that is running the Java program.
A) Compiled Instructions
B) Compiled code
C) byte code
D) Java mid code
Ans-C
9. The command javac
A) Converts a java program into binary code
B) Converts a java program into bytecode
C) Converts a java program into machine language
D) Convert a java program into hardware
Ans-B
10. Which of the following is
not the Java primitive type
A) Byte
B) Float
C) Character
D) Long double
Ans-D
11. Command to
execute compiled java program is
A) java
B) javac
C) run
D) javaw
Ans-A
12. Inner classes are
A) anonymous classes
B) nested classes
C) subclasses
D) derived classes
Ans-B
13. All Java classes are
derived from
A) java.lang.Class
B) java.util.Name
C) java.lang.Object
D) java.awt.Window
Ans-C
14. The jdb is used to
A) Create a jar archive
B) Debug a java program
C) Create a C header file
D) Generate java documentation
Ans-B
15. Which of the following is not a Java features?
a Dynamic
b.
Architecture Neutral
c.
Use of pointers
d.
Object-oriented
Ans-C
16. The
\u0021 article referred to as a
a. Unicode escape sequence
b.
Octal escape
c.
Hexadecimal
d.
Line feed
Ans-A
17. Which
of the following is a valid declaration of a char?
a. char ch = '\utea';
b.
char ca = 'tea';
c.
char cr = \u0223;
d.
char cc = '\itea';
Ans-A
18. What is the return type of the
hashCode() method in the Object class?
a. Object
b.
int
c.
long
d.
void
Ans-B
19. What does the expression float
a = 35 / 0 return?
a. 0
b.
Not a Number
c.
Infinity
d.
Run time exception
Ans-C
20. Which of the following creates
a List of 3 visible items and multiple selections abled?
a. new List(false, 3)
b.
new List(3, true)
c.
new List(true, 3)
d.
new List(3, false)
Ans-B
21. Which method will a web browser call on a new applet?
A) main method
B) destroy method
C) execute method
D) init method
Ans-D
22. When a programming class implements an interface, it must provide behavior for
A) two methods defined in that interface
B) any methods in a class
C) only certain methods in that interface
D) all
methods defined in that interface
23. In Java, …………. can only test for
equality, whereas ………… can evaluate any type of Boolean expression.
A) switch, if
B) if, switch
C) if, break
D) continue, if
Ans-D
24. The
third type of comment is used by a tool called ……………… for automatic generation
of documentation.
A) Java commenting
B) Java generator
C) Java
doc
D) Java loc
Ans-c
25. The
class at the top of exception class hierarchy is ……………………..
A) ArithmeticException
B)
Throwable
C) Class
D) Exception
Ans-B
26. Which
package contains the Random class?
a. java.util package
b.
java.lang package
c.
java.awt package
d.
java.io package
Ans-A
27. Which option is false about
the final keyword?
a. A final method cannot be
overridden in its subclasses.
b.
A final class cannot be
extended.
c.
A final class cannot extend other classes.
d.
A final method can be
inherited.
Ans-C
28. Which of the following is a
reserved keyword in Java?
a. object
b.
strictfp
c.
main
d.
system
Ans-B
29. Which keyword is used for
accessing the features of a package?
a. package
b.
import
c.
extends
d.
export
Ans-B
30. Which of the given methods are
of Object class?
a. notify(), wait( long msecs
), and synchronized()
b.
wait( long msecs ),
interrupt(), and notifyAll()
c.
notify(), notifyAll(), and wait()
d.
sleep( long msecs ),
wait(), and notify()
Ans-C
31. A package is a collection of
A) classes
B) interfaces
C) editing tools
D) classes and interfaces
Ans-D
32. The
concept of multiple inheritances is implemented in Java by
A) extending two or more classes
B) extending one class and implementing one or
more interfaces
C) implementing two or more interfaces
D) both B
and C
Ans-D
33. Which
of the following do not represent legal flow control statements?
A) break;
B) return;
C)
exit();
D) continue outer;
Ans-C
34. Which
of the following is a mutable class in java?
a. java.lang.String
b.
java.lang.Byte
c.
java.lang.Short
d.
java.lang.StringBuilder
Ans-D
35. Using which keyword we can access the value of the instance
variables and class variables of that class inside the method of that class
itself.
A) super
B) final
C) this
D) either super or this
Ans-C
36. 1. In java a ………………….. is a sequence of characters.
A) string
B) arrayChar
C) groupChar
D) collection
Ans :B
37. . Java programs perform I/O through ………..
A) I/O methods
B) I/O package
C) streams
D) compiler
38. The default package that is implicitly called in a java program
is ………….
A) java. Lang
B) java.System
C) java. Window
D) java.Lang.System
39. What is the file
extension of a compiled java program?
A) .class
B) .java
C) .css
D) .html
40. ……………… keyword is
used to invoke the current object.
A) New
B) That
C) This
D) Me
41. Which of the
function is used to convert string to Number in java program?
A) to Number()
B) conString()
C) valueOf()
D) toString()
42. Which of this keyword can be used in a subclass to
call the constructor of superclass?
a) super
b) this
c) extent
d) extends
43. Which of these is correct way of calling a constructor
having no parameters, of superclass A by subclass B?
a) super(void);
b) superclass.();
c) super.A();
d)
super();
44. Which of these is
supported by method overriding in Java?
a) Abstraction
b) Encapsulation
c)
Polymorphism
d) None of the mentioned
45. What keyword is used to
explicitly raise a exception?
a)catch
b)throw
c)throws
d)raise
46. What block is always
executed, independently of a exception being raised?
a)throws
b)finally
c)catch
d)throw
47. Which of these is not a interface in the
Collections Framework?
a)Collection
b)Group
c)Set
d)List
48. Which provides better performance for the
insertion and removal from the middle of the list?
a)Vector
b)ArrayList
c)LinkedList
d)HashMap)
49. From the following statements which is a
disadvantage of an java array?
a. An array can hold primitive types data
b. An array has its size that is known as array length
c. An array knows only its type that it contains. Array type is
checked at the compile-time
d. An array holds only
one type of data
50. How many reserved keywords are currently defined
in the Java language?
a. 48
b. 49
c. 50
d. 47
51. Which method of string class in java is used to convert the
boolean into String?
a. public static String
valueOf(double I)
b. public static String valueOf(boolean I)
c. public boolean equals(Object anObject)
d. public static String valueOf(Object obj)
52. Which keyword is used for the block
to handle the exceptions generated by try block?
a. Catch
b. Final
c. throw
d. try
53. Which is a technique in Java in which a class can have any
number of constructors that differ in parameter lists?
a. Constructor
overloading
b. Method overloading
c. Operator overloading
d.Method overriding
54. The
life cycle of an applet is described by ……………… methods.
A) six
B) three
C) four
D) five
55. ……..
statement is valid for array declaration.
A. int number();
B. float number();
C. float number[];
D. count int[];
56. ……. operators which
concatenates two strings.
A. +
B. ++
C. –
D. +-
57. A
…….. class may not have any abstract method.
A. abstract
B. static
C. final
D. public
58. Which of the following
is a valid syntax to synchronize the HashMap?
a.
Map m =
hashMap.synchronizeMap();
b.
HashMap map =hashMap.synchronizeMap();
c.
Map m1 =
Collections.synchronizedMap(hashMap);
d.
Map m2 =
Collection.synchronizeMap(hashMap);
Ans-C
No comments:
Post a Comment