Programming in Java | Week 1

Session: Jan-Apr 2025

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



Course name: Programming In Java

Course Link: Click Here

For answers or latest updates join our telegram channel: Click here to join

Programming in Java Nptel Week 1 Assignment Answers (Jan-Apr 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.

Answer: Click here to view the answer


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

Answer: Click here to view the answer


Que. 3) Which of the following is not an object-oriented programming paradigm?:
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Dynamic memory allocation

Answer: Click here to view the answer


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.

Answer: Click here to view the answer


Que. 5) Which of the following is not a Language Processor?:
a) Assembler
b) Compiler
c) Interpreter
d) Fortran

Answer: Click here to view the answer

See also  Programming In Java | Week 3

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

Answer: Click here to view the answer


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

Answer: Click here to view the answer


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.

Answer: Click here to view the answer


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

Answer: Click here to view the answer


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

Answer: Click here to view the answer


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

Programming in Java Nptel Week 1 Assignment Answers (JULY-AUG 2024)


Q1.Which of the following is not a valid comment in Java?
a. /** comment */
b. /* comment */
c. / *comment /
d. // comment

See also  Programming In Java | Week 4

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

See also  Programming in Java | Week 7

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


These are Programming In Java Week 1 Assignment 1 Nptel Answers