0% found this document useful (0 votes)
51 views2 pages

Java Aptitude Questions & Answers

The document contains a series of Java and aptitude questions along with their answers, covering topics such as exceptions, data structures, algorithms, and database normalization. Key concepts include Java Null Pointer Exceptions, Big O notation, method overriding, and AVL tree rebalancing. The document serves as a quick reference for common programming and algorithmic challenges.

Uploaded by

SREE RAM THURAKA
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views2 pages

Java Aptitude Questions & Answers

The document contains a series of Java and aptitude questions along with their answers, covering topics such as exceptions, data structures, algorithms, and database normalization. Key concepts include Java Null Pointer Exceptions, Big O notation, method overriding, and AVL tree rebalancing. The document serves as a quick reference for common programming and algorithmic challenges.

Uploaded by

SREE RAM THURAKA
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java & Aptitude Questions with Answers

1. Java Null Pointer Exception Question


Answer: exception

2. Big O for sum 1+2+...+n


Answer: O(n)

3. Java Method Overriding


Answer: B

4. Max-Heap Priority Queue


Answer: 10, 8, 7, 3, 2, 1, 5

5. Make Utility Algorithm


Answer: Topological Sorting

6. Train Problem (Rampur-Sitapur)


Answer: Both trains are equidistant

7. Candidate Key Problem


Answer: {A, B, D}

8. 3NF Database
Answer: Transitive Dependency

9. AVL Tree Rebalancing Time Complexity


Answer: O(log n)

10. Linear Data Structure


Answer: Array

11. Race Problem


Answer: Harinder followed by Maninder

12. Stack & Queue Operations


Answer: C

13. HashMap Duplicate Key


Answer: It will replace the old mapping

14. Join Operation Maximum Rows


Answer: Full Outer Join

15. Hash Table with Closed Hashing


Answer: 0:1, 1:8, 2:10, 3:_, 4:_, 5:_, 6:3

16. Merge Sort Average Case Time Complexity


Answer: O(n log n)

17. Java Constructor Return Type


Answer: Constructors have no return type

18. Sorting Identical Elements


Answer: Insertion Sort
19. Java Execution Order
Answer: Static Block → Instance Block → Constructor → Method

20. Family Granddaughter


Answer: Granddaughter is a student

21. Java Polymorphism


Answer: CMe

22. Constructor Return Type


Answer: None

23. Cycle Detection in Directed Graph


Answer: Edge from currently being visited node to an ancestor

24. Java Thread Output


Answer: A C B

You might also like