Every question in the paper gets a full exam-length answer in the app — organised by marks, the way a topper writes it.
7 marks Long answer
Write a java program to sum first n natural numbers.
Show answer outline
Use a loop to iterate from 1 to n and accumulate the sum.
The full exam-length answer is in the app.
7 marks Long answer
Draw and explain life cycle of Thread.
Show answer outline
The thread life cycle includes states like New, Runnable, Blocked, Waiting, Timed Waiting, and Terminated.
The full exam-length answer is in the app.
7 marks Long answer
With the help of example explain use of break and continue in java.
Show answer outline
Break exits the loop, while continue skips the current iteration.
The full exam-length answer is in the app.
7 marks Long answer
Write a code segment to get input from keyboard in java. Import all necessary packages.
Show answer outline
Use Scanner class from java.util package to read input.
The full exam-length answer is in the app.
7 marks Long answer
Write a java program for adding two 2x2 matrix.
Show answer outline
Use nested loops to iterate and sum corresponding elements.
The full exam-length answer is in the app.
7 marks Long answer
Write a java program to sort an array of five integers in descending order.
Show answer outline
Use Arrays.sort() with a custom comparator or implement a sorting algorithm.
The full exam-length answer is in the app.
7 marks Long answer
Show the two methods which are used to create a thread in Java.
Show answer outline
Threads can be created by extending Thread class or implementing Runnable interface.
The full exam-length answer is in the app.
4 marks Medium answer
Explain the syntax of loops in java.
Show answer outline
Loops in Java include for, while, and do-while with specific syntax for each.
The full exam-length answer is in the app.
4 marks Medium answer
Write java syntax to create array with five integers. (use array initialization)
Show answer outline
int[] arr = {1, 2, 3, 4, 5};
The full exam-length answer is in the app.
4 marks Medium answer
Write a java syntax to create a two dimensional array with 3 row and 3 columns. Also initialize the array.
Show answer outline
int[][] arr = {{1,2,3}, {4,5,6}, {7,8,9}};
The full exam-length answer is in the app.
4 marks Medium answer
Define exception. Explain throw and throws.
Show answer outline
An exception is an event that disrupts the normal flow of execution; 'throw' is used to explicitly throw an exception, while 'throws' declares an exception in a method signature.
The full exam-length answer is in the app.
4 marks Medium answer
With the help of example explain the priority queue in java.
Show answer outline
PriorityQueue orders elements based on their natural ordering or a comparator.
The full exam-length answer is in the app.
3 marks Medium answer
With the help of example explain handling events in javaFX.
Show answer outline
Event handling in JavaFX involves using event handlers to respond to user actions.
The full exam-length answer is in the app.
2 marks Short answer
Define Object, Class and Instance
Show answer outline
Object is an instance of a class, a Class is a blueprint for creating objects, and an Instance is a specific realization of a class.
The full exam-length answer is in the app.
2 marks Short answer
List any four features of Object oriented programming language.
Show answer outline
Features include encapsulation, inheritance, polymorphism, and abstraction.
The full exam-length answer is in the app.
2 marks Short answer
List and explain any three category of operator in java.
Show answer outline
Categories include arithmetic operators, relational operators, and logical operators.
The full exam-length answer is in the app.
2 marks Short answer
Explain abstract method using example.
Show answer outline
An abstract method is declared without implementation, requiring subclasses to provide it.
The full exam-length answer is in the app.
2 marks Short answer
Explain abstract class with the help of example.
Show answer outline
An abstract class cannot be instantiated and can contain abstract methods.
The full exam-length answer is in the app.
2 marks Short answer
Compare run time and compile time exception.
Show answer outline
Compile time exceptions are checked at compile time, while runtime exceptions occur during program execution.
The full exam-length answer is in the app.
2 marks Short answer
List various UI Controls in javaFX.
Show answer outline
Controls include Button, Label, TextField, and ComboBox.
The full exam-length answer is in the app.
2 marks Short answer
List various classes of java.io package used for Text IO.
Show answer outline
Classes include FileReader, BufferedReader, PrintWriter.
The full exam-length answer is in the app.
2 marks Short answer
List various classes of java.io package used for Binary IO.
Show answer outline
Classes include FileInputStream, FileOutputStream, ObjectInputStream.
The full exam-length answer is in the app.
2 marks Short answer
Compare Set and List in java.
Show answer outline
Set does not allow duplicates, while List allows duplicates and maintains insertion order.
The full exam-length answer is in the app.
2 marks Short answer
Compare Vector and Stack.
Show answer outline
Vector is synchronized and can grow dynamically, while Stack is a subclass of Vector with LIFO behavior.
The full exam-length answer is in the app.
2 marks Short answer
List various static methods of List.
Show answer outline
Static methods include of(), copyOf(), and toArray().
The full exam-length answer is in the app.