NPTEL Programming in Java
Model Question Paper
Duration: 3 Hours
Maximum Marks: 100
Answer all questions. All questions carry equal marks.
Part A – Multiple Choice (2 marks each)
1. Which of the following is NOT a feature of Java?
a) Platform Independence b) Object-Oriented
c) Pointer Arithmetic d) Automatic Garbage Collection
2. Which package contains the Random class in Java?
a) java.util b) java.lang c) java.io d) java.math
3. What is the output of: System.out.println(10 + 20 + "Java");
a) 30Java b) 1020Java c) Compilation Error d) Java30
4. Which keyword is used to inherit a class in Java?
a) super b) this c) extends d) implements
Part B – Short Answer (5 marks each)
5. Explain the difference between abstract class and interface in Java.
6. Write a Java program to create a thread using the Runnable interface.
7. Describe the concept of Exception Handling in Java with examples.
8. What are Java Collections? Explain ArrayList with a code snippet.
Part C – Programming (10 marks each)
9. Write a Java program to read a text file and count the number of words.
10. Develop a Java application using Swing to create a simple calculator.