NPTEL Programming In Java Week 1 Assignment Answers 2024
1. What is the primary focus of Java programming?
a. Low-level optimizations
b. Hardware-specific operations
c. Platform independence
d. Assembly language programming
Answer :- c
Explanation: Java is designed to be platform-independent using the concept of “Write Once, Run Anywhere,” meaning compiled Java code can run on any device that has the Java Virtual Machine (JVM).
2. 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
Answer :- c
Explanation: Java follows the Object-Oriented Programming (OOP) paradigm, which focuses on objects and classes for building modular and reusable code.
3. What is the last step in the Java programming process?
a. Java Program Execution
b. Java Program Editing
c. Java Program Compilation
d. C/C++ versus Java
Answer :- a
Explanation: The final step is program execution where the compiled bytecode is run by the Java Virtual Machine.
4. Which of the following is NOT a Java programming tool?
a. Eclipse
b. NetBeans
c. IntelliJ IDEA
d. GCC
Answer :- d
Explanation: GCC is a compiler for C/C++ languages, not a Java IDE. Eclipse, NetBeans, and IntelliJ IDEA are popular tools for Java development.
5. What does the term “Write Once, Run Anywhere” (WORA) imply in Java?
a. Code reusability
b. Platform independence
c. Cross-compilation
d. Dynamic typing
Answer :- b
Explanation: WORA means once the Java code is written and compiled, it can run on any platform that supports JVM, making it platform-independent.
6. In Java, what is used to store multiple values of the same type?
a. Structures
b. Pointers
c. Arrays
d. Lists
Answer :- c
Explanation: Arrays in Java are used to store multiple values of the same data type in a single variable.
7. Which of the following is a valid identifier in Java?
a. 123identifier
b. _identifier
c. #identifier
d. identifier-123
Answer :- b
Explanation: Identifiers in Java cannot begin with a digit, contain special symbols like #
or -
, but they can begin with an underscore (_
).
8. What is the purpose of Java Language Subset?
a. To limit the capabilities of Java
b. To make Java code compatible with other languages
c. To define a smaller set of Java features for specific purposes
d. To enhance the performance of Java programs
Answer :- c
Explanation: The Java Language Subset defines a reduced set of Java features suitable for constrained environments like embedded systems.
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
Answer :- b
Explanation: JVM allows Java bytecode to be executed on any platform, ensuring platform independence which is a core Java feature.
10. What is emphasized during the Java Program Editing phase?
a. Writing platform-specific code
b. Debugging the program
c. Compiling the program
d. Writing and modifying the source code
Answer :- d
Explanation: The editing phase involves writing and modifying the source code in a text editor or IDE before compiling.