Complete the sentence: 'Despite his wealth, he lived _____ lifestyle.'
Answer: A
'A modest' is grammatically correct. 'Modest' starts with a consonant sound, so we use 'a' not 'an'.
Q.22Medium
What is the main idea of the passage? 'Climate change is altering precipitation patterns worldwide. Regions experiencing increased rainfall face flooding, while others endure severe droughts.'
Answer: B
The passage explains that climate change affects different regions differently - some get more rain (floods) while others get less (droughts).
Q.23Medium
Identify the error: 'Each of the students are required to submit their projects by Friday.'
Answer: A
'Each' is singular, so it should be 'is' not 'are'. Correct sentence: 'Each of the students is required to submit their project by Friday.'
Q.24Easy
What does the idiom 'break the ice' mean?
Answer: B
'Break the ice' idiomatically means to initiate conversation or ease tension in a social situation.
Q.25Medium
Which of the following is NOT a programming paradigm?
Answer: C
Linear Programming is an optimization technique, not a programming paradigm. The others are paradigms used in software development.
Advertisement
Q.26Medium
Which data structure is best for implementing a queue?
Answer: B
Linked List is ideal for queue implementation as it provides O(1) insertion and deletion at both ends.
Q.27Hard
What will be the output of the following code?
int x = 5;
int y = ++x + x++;
System.out.println(y);
Answer: B
++x makes x=6 (pre-increment). Then x++ uses 6 and increments to 7. So y = 6 + 6 = 12.
Q.28Medium
Which of the following sorting algorithms is most efficient for nearly sorted data?
Answer: C
Insertion Sort has O(n) time complexity for nearly sorted data, making it the most efficient choice.
Q.29Medium
What will be printed?
String s1 = new String('Amazon');
String s2 = new String('Amazon');
System.out.println(s1 == s2);
Answer: B
== compares memory references. Both s1 and s2 are different objects, so it prints false. Use .equals() for value comparison.
Q.30Medium
What is the primary purpose of a hash function?
Answer: B
A hash function takes input data and produces a fixed-size output (hash value), useful for hash tables and data indexing.
Q.31Hard
Which of the following is a characteristic of a good hash function?
Answer: D
Good hash functions are deterministic (same input gives same output), uniformly distribute values, and minimize collisions.
Q.32Easy
In the context of REST APIs, what does POST primarily do?
Answer: B
POST method is used to create new resources on the server. GET retrieves, PUT/PATCH updates, DELETE removes.
Q.33Medium
What is the main advantage of using microservices architecture?
Answer: B
Microservices allow independent scaling, deployment, and technology choices. However, they can increase operational complexity.
Q.34Easy
Which design pattern is used when you want to ensure a class has only one instance?
Answer: B
Singleton Pattern restricts a class to have only one instance and provides a global access point to it.
Q.35Medium
What will be the output?
List<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
list.remove(1);
System.out.println(list);
Answer: A
list.remove(1) removes the element at index 1 (which is 2), leaving [1, 3].
Q.36Medium
What is the difference between ArrayList and LinkedList in Java?
Answer: C
ArrayList has O(1) random access but O(n) insertion/deletion. LinkedList has O(n) access but O(1) insertion/deletion.
Q.37Easy
Which of the following is NOT a principle of object-oriented programming?
Answer: D
The four OOP principles are Inheritance, Encapsulation, Polymorphism, and Abstraction. 'Materialization' is not an OOP principle.
Q.38Easy
What is the purpose of the 'try-catch' block in Java?
Answer: B
try-catch blocks allow you to handle exceptions without crashing the program, providing graceful error handling.
Q.39Hard
If a HashMap has 1000 entries and the load factor is 0.75, at what capacity will it resize?
Answer: C
Resize occurs when entries exceed capacity × load factor. If 1000 entries at 0.75 load factor, capacity = 01000.75 = 1333
Q.40Medium
What is the time complexity of accessing an element in a balanced Binary Search Tree?
Answer: B
In a balanced BST, the height is log n, so searching takes O(log n) time.