Campus recruitment tests follow their own rhythm: a fixed time limit, a mix of sections, and negative marking that punishes guessing. This collection mirrors that format with quantitative aptitude, logical reasoning, verbal ability, and technical questions of the kind IT and core companies actually ask. Use it to build exam stamina, not just to check whether you know a topic.
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.562Medium
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.563Medium
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.564Medium
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.565Hard
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.566Easy
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.567Medium
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.568Easy
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.569Medium
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.570Medium
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.571Easy
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.572Easy
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.573Hard
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.574Medium
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.
Q.575Easy
Which protocol is used for secure data transmission over the internet?
Answer: B
HTTPS (HTTP Secure) encrypts data in transit using SSL/TLS. Other protocols lack this encryption.
Q.576Easy
What does the SELECT * query do in SQL?
Answer: B
SELECT * retrieves all columns and rows from a table. * is a wildcard meaning 'all columns'.
Q.577Medium
A train travels from City A to City B at 60 km/h and returns from B to A at 40 km/h. If the total journey time is 10 hours, what is the distance between City A and City B?
Answer: A
Let distance = d km. Time A to B = d/60 hours, Time B to A = d/40 hours. Total time: d/60 + d/40 = 10. LCM(60,40)=120, so (2d + 3d)/120 = 10, giving 5d/120 = 10, thus d = 240 km.
Q.578Easy
In a sequence, each term is obtained by adding the previous two terms. If the 1st term is 2 and 2nd term is 3, what is the 6th term?
Answer: B
Fibonacci-like sequence: T1=2, T2=3, T3=5, T4=8, T5=13, T6=21. Each term = sum of previous two terms.
Q.579Easy
If PAPER is coded as 16-1-16-5-18, then PENCIL would be coded as?
Answer: A
Each letter is coded as its position in the alphabet: P=16, A=1, P=16, E=5, R=18. Similarly, PENCIL: P=16, E=5, N=14, C=3, I=9, L=12.
Q.580Easy
Four friends A, B, C, and D have different salaries. C earns more than A but less than D. B earns more than D. Who has the highest salary?
Answer: B
From given conditions: A < C < D and D < B. This means B > D > C > A. Therefore, B has the highest salary.