Programming in Java Nptel Week 1 Assignment Answers
Are you looking for Programming in Java Nptel Week 1 Assignment Answers ? You’ve come to the right place! Access the latest and most accurate solutions for your Week 1 assignment in the Programming in Java course
Table of Contents

Programming in Java Nptel Week 1 Assignment Answers (July-Dec 2025)
Que.1 Which of the following is true?
A) Java uses only interpreter.
B) Java uses only compiler.
C) Java uses both interpreter and compiler.
D) None of the above.
Que.2 A Java file with extension ‘.class’ contains
A) Java source code
B) HTML tags
C) Java Byte code
D) A program file written in Java programming language
Que.3 Which of the following is not an object-oriented programming paradigm?
A) Encapsulation
B) Inheritance
C) Polymorphism
D) Dynamic memory allocation
Que.4 What will be the output of the following Java code?
class increment {
public static void main(string args{]) {
}
}
A) 32
B) 33
C) 24
D) 25
Que.5 What is the correct sequence of steps to execute a Java program?
- Compile the Program: Use the javac command to compile the code into bytecode.
- Edit the Program: Write the code in a text editor or IDE.
- Run the Program: Use the java command to execute the bytecode.
A) Run > Edit > Compile
B) Edit > Run > Compile
C) Compile > Edit > Run
D) Edit > Compile > Run
Que.6 Consider the following code.
class NPTEL {
public static void main(string[] args) {
ystem.out.println("Hello, World!");
}
}
What is the output of the above code?
A) Hello, World!
B) HelloWorld!
C) Compilation Error
D) Runtime Error
Que.7 What is the primary focus of Java programming?
A) Low-level optimizations
B) Hardware-specific operations
C) Platform independence
D) Assembly language programming
Que.8 Which of the following programming principles is a key aspect of Java?
A) Code obfuscation
B) Platform dependence
C) Object-oriented programming
D) Global variables
Que.9 What is the primary purpose of the Java Virtual Machine (JVM) in the Java programming language?
A) Code optimization
B) Platform independence
C) Memory management
D) Hardware-specific operations
Que.10 Consider the following program.
public static void main(string[] args) {
int x = 5;
x *= (2 + 8);
}
What is the output of the above code?
A) 50
B) 10
C) Compiler error
D) 5
Programming in Java Nptel Week 1 Assignment Answers (Jan-Apr 2025)
Course Link: Click Here
Que. 1) Which of the following is true?:
a) Java uses only interpreter.
b) Java uses only compiler.
c) Java uses both interpreter and compiler.
d) None of the above.
Que. 2) A Java file with extension ‘class’ contains:
a) Java source code
b) HTML tags
c) Java Byte code
d) A program file written in Java programming language
Que. 3) Which of the following is not an object-oriented programming paradigm?:
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Dynamic memory allocation
Que. 4) Java is a platform-independent programming language because:
a) It compiles an intermediate code targeting a virtual machine, which can be interpreted by an interpreter for a given OS.
b) The Java compiler translates the source code directly into the machine-level language.
c) It follows the concept of “write once and compile everywhere”.
d) It is written almost similar to the English language.
Que. 5) Which of the following is not a Language Processor?:
a) Assembler
b) Compiler
c) Interpreter
d) Fortran
Que. 6) A platform is the hardware or software environment in which a program runs. Which of the following is/are Java platform component(s)?:
a) HTML
b) Java Virtual Machine
c) JavaScript
d) Hotlava
Que. 7) What is the correct sequence of steps to execute a Java program?:
a) Run → Edit → Compile
b) Edit → Run → Compile
c) Compile → Edit → Run
d) Edit → Compile → Run
These are Programming in Java Nptel Week 1 Assignment Answers
Que. 8) What is the primary difference between javac and java commands?:
a) javac is used to edit Java code, while java runs Java programs.
b) javac compiles Java source code to bytecode, while java executes the bytecode on the JVM.
c) javac executes Java programs, while java is used for compilation.
d) Both are used for compiling Java programs.
Que. 9) Which of the following is not a feature of Java?:
a) Platform Independence
b) Object-Oriented Programming
c) Supports Explicit Pointers
d) Supports Polymorphism
Que. 10) What is the output of the following code?
class NPTEL {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
a) Hello, World!
b) HelloWorld!
c) Compilation Error
d) Runtime Error
Programming in Java Nptel Week 1 Assignment Answers (JULY-AUG 2024)
Course Link: Click Here
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
These are Programming in Java Nptel Week 1 Assignment 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 Nptel Week 1 Assignment 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 Nptel Week 1 Assignment 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 Nptel Week 1 Assignment 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 Nptel Week 1 Assignment Answers
More Weeks of Programming In Java: Click Here
More Nptel Courses: https://progiez.com/nptel-assignment-answers









