NPTEL Programming In Java Week 12 Assignment Answers 2025
1. What is the correct way to create a thread in Java?
a. Implementing the Runnable interface
b. Extending the Thread class
c. Both A and B
d. None of the above
Answer :- For Answers Click Here
2. Which method starts a thread in Java?
a. start)
b. run()
c. execute()
d. init()
Answer :-
3. Which layout arranges components in a row-based order?
a. GridLayout
b. FlowLayout
c. BorderLayout
d. CardLayout
Answer :-
4. What does the setSize (400, 300); method do in a JFrame?
a. Sets the width to 300 and height to 400
b. Sets the width to 400 and height to 300
c. Maximizes the Jframe
d. Closes the Jframe
Answer :-
5. What does the ResultSet object contain in JDBC?
a. Only non-null records from a table
b. All records from a table, including null values
c. Only null records
d. A single column from a table
Answer :- For Answers Click Here
6. What will be the output of
System.out.println(“hello”. length());?
a. 3
b. 5
c. 6
d. 4
Answer :-
7. What is the correct way to declare an array in Java?
a. int arr = new int(5);
b. int[] arr = new int[5];
c. array arr = new int[5];
d. int arrl] = new int);
Answer :-
8. What will be printed by the following code?
System.out.println (“Java”.charAt (1) );
a. J
b. a
c. v
d. A
Answer :-
9.

Answer :-
10. Which Java GUI framework is lightweight?
a. AWT
b. Swing
c. Both A and B
d. None
Answer :- For Answers Click Here