NPTEL Programming In Java Week 2 Assignment Answers 2024

Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Programming In Java Week 2 Assignment Answers 2024

1. In Java programming an object can take many forms. This feature is called ______.

a. Abstraction
b. Polymorphism
c. Encapsulation
d. Inheritance

Answer :-  For Answer Click Here

2. Which of the following is a valid declaration of an object of class, say NPTEL?

a. NPTEL obj = new NPTEL();
b. NPTEL obj = new NPTEL;
c. obj = new NPTEL();
d. new NPTEL obj;

Answer :-  For Answer Click Here

3. A default constructor_______________________

a. has no arguments
b. has no return type
c. has one argument but no return type
d. has two arguments

Answer :-  For Answer Click Here

4. A top-level class may have which one of the following access modifiers?

a. package
b. private
c. protected
d. public

Answer :- 

5. Integer in Java is a\an _______.

a. Adapter class
b. Inner class
c. Not a class
d. Wrapper class

Answer :- 

6. What is true about the new operator?

a. returns a pointer to a variable
b. creates a variable called new
c. obtains memory for a new variable
d. tells how much memory is available

Answer :-  For Answer Click Here

7. Which one is not supported by OOP?

a. Abstraction
b. Polymorphism
c. Encapsulation
d. Global variables

Answer :- 

8. Which of the following modifiers can be used to disallow a method from being overridden?

a. final
b. transient
c. volatile
d. static

Answer :- 

9.

Consider the following code segment

NPTEL Programming In Java Week 2 Assignment Answers 2024

Identify the line number(s) where there is/are error(s) in the above code.

a. 1
b. 2
c. 3
d. 4 and 5

Answer :- 

10. Which of the following is TRUE about print() and println() methods?

a. print() prints in a single line only and multiple lines cannot be printed in any way.
b. println() prints and then appends a line break.
c. println() prints in a single line only and multiple lines cannot be printed.
d. print() prints and then appends a line break.

Answer :- For Answer Click Here