Programming in Java | Week 1
Session: JULY-AUG 2024
Course name: Programming In Java
Course Link: Click Here
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
Q1.Which of the following is not a valid comment in Java?
a. /** comment */
b. /* comment */
c. / *comment /
d. // comment
Answer: c. / *comment /
Q2.What is the output of the following code?
a. NPTEL2024
44java
b. NPTEL44
44java
c. NPTEL2024
2024java
d. NPTEL44
2024java
Answer: a. NPTEL202444java
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
Q3.Which of the following is used to find and fix bugs in the Java programs?
a. JVM
b. JRE
c. JDK
d. JDB
Answer: d. JDB
Q4.What is the value returned by the method f() defined below?
public static int f(int x, int y){return (x>y) ? y : x;}
a. The sum of x and y, that is, x + y.
b. The difference of x and y, that is, x – y.
c. The maximum of x and y, that is, the larger value of x and y.
d. The minimum of x and y, that is, the smaller value of x and y.
Answer: d. The minimum of x and y, that is, the smaller value of x and y.
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
Q5.Consider the following program. What will be the output of the program if it is executed?
a. Print first six even numbers.
b. Print first six odd numbers.
c. Print first six prime numbers.
d. Print first six Fibonacci numbers.
Answer: d. Print first six Fibonacci numbers.
Q6. Which program is used to compile Java source code into bytecode?
a. javap
b. javac
c. java
d. javad
Answer: b. javac
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
Q7. Consider the following program.
a. 50
b. 10
c. Compiler error
d. 5
Answer:a. 50
Q8. What is the incorrect statement about bytecode?
a. Java when compiles the source code, it converts it to bytecode.
b. JVM (Java Virtual Machine) is an interpreter of bytecode.
c. Bytecode is not portable and it needs to be compiled separately for each platform.
d. JVM offers a protected environment which helps in enhanced safety for the system.
Answer:c. Bytecode is not portable and it needs to be compiled separately for each platform.
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
Q9. In Java, what is the role of the public static void main(String[] args) method?
a. Initialization method
b. Execution entry point
c. Constructor
d. Destructor
Answer: b. Execution entry point
Q10. What is the purpose of the break statement in Java?
a. To terminate the program
b. To exit a loop or switch statement
c. To skip the next iteration of a loop
d. To return a value from a method
Answer: b. To exit a loop or switch statement
For answers or latest updates join our telegram channel: Click here to join
These are Programming In Java Week 1 Assignment 1 Nptel Answers
More Weeks of Programming In Java: Click Here
More Nptel Courses: https://progiez.com/nptel-assignment-answers