0% found this document useful (0 votes)
4 views3 pages

Fundamental of Java Class 8 Chapter 1

The document provides a comprehensive overview of Java programming concepts for Class 8 students, including fill-in-the-blanks, short questions, and multiple-choice questions. Key topics covered include Java's history, data types, operators, and the importance of the JVM. Additionally, it addresses common programming errors and debugging techniques.

Uploaded by

wecomputerdotcom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Fundamental of Java Class 8 Chapter 1

The document provides a comprehensive overview of Java programming concepts for Class 8 students, including fill-in-the-blanks, short questions, and multiple-choice questions. Key topics covered include Java's history, data types, operators, and the importance of the JVM. Additionally, it addresses common programming errors and debugging techniques.

Uploaded by

wecomputerdotcom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer dot com / halisahar / bagmore / 2026 / Class- 8

Computer Dot Com


A complete computer education
Under W.B. Gov Registered

Fill in the Blanks (Answers Included):

1. Java was developed by Sun Microsystems in 1995.


2. A Compiler converts high-level instructions into machine language.
3. The Write Once, Run Anywhere principle makes Java platform-independent.
4. Identifiers are names assigned to components like classes and variables.
5. The double data type is sufficient for storing 15 decimal digits.
6. A Constant is a value that does not change during program execution.
7. Logical operators (&&, ||) are used for decision-making.
8. Java is case-sensitive, meaning 'Value' and 'value' are different.
9. Punctuators are symbols used to separate tokens, like parentheses ().
10. The main() method is the starting point of any Java program.

Short Questions:

1. What is Bytecode? It is machine-independent code produced by the Java compiler.


2. Define a Class. A blueprint or template used to create objects.
3. Difference between Post and Pre increment? Post-increment uses the value then
increases it; Pre-increment increases first.
4. What is a Syntax Error? A mistake in the code rules (like a missing semicolon) that
stops compilation.
5. Explain the JVM. It is the software that runs Java bytecode on a specific computer.

Multiple Choice Questions (MCQs)

1. Which language uses only 0s and 1s? a) High-level language b) Low-level language c)
Assembly language d) Natural language Answer: b) Low-level language
2. What does JVM stand for? a) Java Variable Method b) Java Virtual Machine c) Java
Visual Model d) Just Virtual Machine Answer: b) Java Virtual Machine
3. Which principle is Java based on? a) Write Once, Read Anywhere b) Write Only, Run
Anywhere c) Write Once, Run Anywhere d) Write Often, Run Anywhere Answer: c)
Write Once, Run Anywhere
4. Which of these is a valid variable name in Java? a) 1stValue b) my-value c) _myValue
d) class Answer: c) _myValue
5. Which keyword is used to declare a class in Java? a) define b) new c) class d) object
Answer: c) class
6. Which operator is used to calculate the remainder of a division? a) / b) * c) % d) &&
Answer: c) %
7. A variable declared inside a method is called a: a) Local variable b) Instance variable
c) Static variable d) Global variable Answer: a) Local variable
Computer dot com / halisahar / bagmore / 2026 / Class- 8

8. Which data type stores true or false values? a) int b) float c) boolean d) char Answer:
c) boolean
9. What symbol is used to end a Java statement? a) . b) , c) : d) ; Answer: d) ;
10. The BEDMAS rule is used for: a) Creating objects b) Solving mathematical expressions
c) Declaring variables d) Writing comments Answer: b) Solving mathematical
expressions

Fill-in-the-Blanks

1. Programming is the process of creating a set of ________ that tells a computer how to
perform a task. Answer: instructions
2. The ________ acts as a run-time engine to run Java applications. Answer: JVM
3. In Object-Oriented Programming (OOP), a ________ is a blueprint for creating objects.
Answer: class
4. Java is ________-sensitive, meaning "myVar" and "myvar" are treated as different
names. Answer: case
5. ________ comments start with /* and end with */. Answer: Multi-line
6. The && operator is an example of a(n) ________ operator. Answer: logical
7. A ________ is a memory location that can hold any value and change over time. Answer:
variable
8. ________ are reserved words in Java that have a special meaning (e.g., public, static).
Answer: Keywords
9. The data type float is used to store ________ numbers. Answer: fractional (or decimal)
10. A ________ error occurs when there are spelling or punctuation mistakes in the code.
Answer: syntax

Find the Error (Debugging)

1. Error: int x = 10 Correction: int x = 10; (Missing semicolon)


2. Error: Class Welcome { } Correction: class Welcome { } (Java keywords must be
lowercase)
3. Error: int 1stNumber = 5; Correction: int firstNumber = 5; (Variable names
cannot begin with a number)
4. Error: [Link]("Hello".) Correction:
[Link]("Hello"); (The period should be outside the quotes, and the
semicolon is needed at the end)
5. Error: int float = 20; Correction: int myValue = 20; (Keywords like 'float'
cannot be used as variable names)
Computer dot com / halisahar / bagmore / 2026 / Class- 8

Short Questions & Answers

1. Q: What is programming? A: Programming is the process of creating a set of


instructions that tells a computer how to perform a task.
2. Q: What is the difference between a high-level language and a low-level language?
A: A low-level language is formed using 0s and 1s (binary), which is machine-
understandable. A high-level language is human-friendly and uses English-like words to
make programming simpler for humans.
3. Q: What is the purpose of a compiler in Java? A: A compiler converts high-level
program instructions into machine-independent bytecode that the JVM can execute.
4. Q: Define the term "class" in OOP. A: A class is a blueprint or template used for
creating objects, defining the structure and behavior that those objects will have.
5. Q: What are Java tokens? A: Tokens are the smallest building blocks of a Java
program, such as identifiers, keywords, constants, punctuators, and operators.
6. Q: What is the difference between a local variable and an instance variable? A: A
local variable is declared inside a method and is only accessible within that method. An
instance variable is declared inside a class but outside of any method and represents the
attributes of objects created from that class.
7. Q: List three primitive data types in Java mentioned in the chapter. A: Any three of:
byte, short, int, long, float, double, boolean, char.
8. Q: Why is Java considered a "platform-independent" language? A: It is based on the
"Write Once, Run Anywhere" principle, where the compiled bytecode can run on any
machine equipped with a Java Virtual Machine (JVM).
9. Q: What are the three types of comments in Java? A: Single-line comment, Multi-line
comment, and Documentation comment.
10. Q: What is the purpose of the main() method in a Java program? A: The main()
method is the execution point of the program; if a program does not have a main()
method, it will not execute.

You might also like