NPTEL Programming In Java Week 4 Assignment Answers 2024

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

NPTEL Programming In Java Week 4 Assignment Answers 2024

1. Which is the keyword used to specify the default access modifier in java?

a. default
b. DEFAULT
c. package
d. “There is no keyword”

Answer :-  For Answer Click Here

2. What is the output of the Java program with access modifiers?

NPTEL Programming In Java Week 4 Assignment Answers 2024

a. FOUR
b. Runtime Error
c. null
d. Compiler Error

Answer :-  For Answer Click Here

3. What is the output of the below Java Code Snippet with access modifiers?

NPTEL Programming In Java Week 4 Assignment Answers 2024

a. Weeks = 0
b. Weeks = 12
c. No Error, blank output
d. Compiler error

Answer :-  For Answer Click Here

4. Which of the following is the correct representation of access modifiers in order of increasing visibility?

a. private < default < protected < public
b. private < protected < default < public
c. public < protected < default < private
d. protected < default < private < public

Answer :- 

5. Which of the following package stores all the standard java classes?

a. java.util
b. java.lang
c. java.java
d. java.packages

Answer :- 

6. Which of the following is/are true about packages in Java?

1.    Every class is part of some package.

2.    All classes in a file are part of the same package.

3.    If no package is specified, the classes in the file go into a special unnamed package.

4.    If no package is specified, a new package is created with folder name of class and the class is put in this package.

a. Only 1, 2 and 3
b. Only 1, 2 and 4
c. Only 4
d. Only 1 and 3

Answer :-  For Answer Click Here

7. What is the output of following Java program?

NPTEL Programming In Java Week 4 Assignment Answers 2024

a. Compiler Error
b. Runtime Error
c. Welcome!
d. None of the above

Answer :- 

8. Which of these access specifiers can be used for an interface?

a. Public
b. Protected
c. private
d. All of the mentioned

Answer :- 

9. Which of the following is the correct way of implementing an interface salary by class manager?

a. class Java extends NPTEL {}
b. class Java implements NPTEL {}
c. class Java imports NPTEL {}
d. none of the mentioned

Answer :- 

10. What will be the output of the following Java program?

NPTEL Programming In Java Week 4 Assignment Answers 2024

a. 0
b. 2
c. 4
d. Compiler Error

Answer :- For Answer Click Here