TCS NQT Practice Technical Questions set 4
91. If a common property is referred by many objects of same class, then that property must be declared as _ in class.
A. static
B. void
C. transient
D. final
Ans. A
92. Which is a wrong combination of keywords ?
A. public abstract
B. static abstract
C. static final
D. None of these
Ans. B
93. How can you read the content of a class file on console ?
A. java
B. javap
C. javac
D. javadoc
Ans. C
94. How many type of Primitive Data Types exist in Java?
A. 4
B. 6
C. 8
D. 12
Ans. C
95. Method overloading does not allow :
A. Difference in no. of arguments.
B. Difference in Arguments data type.
C. Difference in return type.
D. Difference in method name.
Ans. D
96. Which Class provides you a Mutable String with thread safe and thread unsafe operations ?
A. String & StringBuilder
B. StringBuilder & StringBuffer
C. String & StringBuffer
D. None of these
Ans. B
97. How to sort an array in Java ?
A. Array.sort()
B. Arrays.sort()
C. Collection.sort()
D. System.sort()
Ans. B
98. An array elements are always stored in __ memory locations.
A. Sequential
B. Random
C. Both
D. None
Ans. A
99. What is the order of variables in Enum in Java ?
A. Ascending order
B. Descending order
C. Random order
D. Depends on the order() method.
Ans. A
100. If you access an uninitialized local variable will result?
A. 0 will be printed
B. Runtime Error
C. Compile Error
D. None of these
Ans. C
101. Which of the following is a type of polymorphism in Java?
A. Aggregation
B. Composition
C. Encapsulation
D. Association
Ans. D
102. Method overriding is combination of :
A. Inheritance + Abstraction
B. Inheritance + Polymorphism
C. Inheritance + Encapsulation
D. Encapsulation + Abstraction
Ans. B
103. Object-oriented inheritance models the following relationship
A. is a kind of
B. has a
C. want to be
D. None of these
Ans. A
104. Wrapping up of data in two or more forms is referred to as
A. Inheritance
B. Encapsulation
C. Polymorphism
D. Modularity
Ans. B
105. Which of the following is a type of polymorphism in Java?
A. Compile Time
B. Execution Time
C. Multiple
D. Multilevel
Ans. A