MCQ Quiz - Class 8 - Programming

MCQ Quiz — Programming (Java & BlueJ)
Test Your Knowledge — Think, Code and Grow! This comprehensive quiz contains 20 Multiple Choice Questions covering programming basics, Java syntax, variables, data types, operators, input/output, BlueJ IDE, and compilation. Check your answers with detailed explanations!
Quiz Instructions
Read Carefully
- ✓ 20 Multiple Choice Questions.
- ✓ Each question has 4 options (A, B, C, D).
- ✓ Choose the correct answer.
- ✓ Each correct answer = 5 Marks.
- ✓ Total Marks = 100.
- ✓ Duration: 30-40 minutes.
- ✓ Topics: Programming basics, Java syntax, variables, operators, BlueJ.
What is Programming?
Programming is the process of writing instructions in a language that a computer can understand to perform a task.
Section 1: Basics (Q1-Q4)
Question 1
What is programming?
A. Playing games
B. Writing instructions for computer
C. Watching videos
D. Drawing pictures
Question 2
Which is a programming language?
A. English
B. Hindi
C. Java
D. French
Question 3
What is a variable?
A. Fixed value
B. Named storage for values
C. Function
D. Class
Question 4
Which is an integer data type?
A. String
B. int
C. char
D. boolean
int stores whole
numbers. String is text, char is single character, boolean
is true/false.
Section 2: Data Types (Q5-Q6)
Question 5
What data type stores decimal numbers?
A. int
B. char
C. double
D. boolean
double stores
decimal numbers like 3.14 or 99.99. float is
also used but double is more precise.
Question 6
Which stores true or false?
A. int
B. char
C. String
D. boolean
boolean data type
can hold only two values: true or
false.
Section 3: Operators (Q7-Q9)
Question 7
What is the assignment operator?
A. ==
B. =
C. +=
D. !=
= is the
assignment operator. It assigns the value on the right to
the variable on the left. == is comparison;
!= is "not equal to".
Question 8
What is arithmetic operator for addition?
A. -
B. *
C. +
D. /
+ is addition.
- is subtraction, * is
multiplication, / is division.
Question 9
What does % operator do?
A. Adds
B. Multiplies
C. Gives remainder
D. Assigns
% gives the remainder after division. Example:
10 % 3 = 1.
Section 4: IDE & Tools (Q10-Q11)
Question 10
Full form of IDE?
A. Internal Development Env
B. Integrated Development Environment
C. Input Data Editor
D. Internet Editor
Question 11
BlueJ is used for?
A. Playing games
B. Java programming
C. Drawing
D. Music
Section 5: I/O & Compilation (Q12-Q15)
Question 12
Which is used for input in Java?
A. print
B. Scanner
C. output
D. compile
java.util.Scanner.
Question 13
Which is used for output in Java?
A. Scanner
B. System.out.println
C. import
D. read
System.out.println() is used to print output to
the console in Java.
Question 14
What is compilation?
A. Running code
B. Converting code to machine language
C. Debugging
D. Writing
Question 15
What is an identifier?
A. Value
B. Name given to variable/class/method
C. Operator
D. Symbol
studentName, HelloWorld.
Section 6: Advanced Concepts (Q16-Q20)
Question 16
Which is a valid identifier?
A. 1name
B. name1
C. name-1
D. na@me
- or @. Only
name1 is valid.
Question 17
Output of: int x=5; System.out.println(x+3);
A. 5
B. 3
C. 8
D. 53
Question 18
Output of: System.out.println(10/3);
A. 3.33
B. 3
C. 10
D. Error
10.0/3.
Question 19
Which command imports Scanner in Java?
A. include Scanner
B. import java.util.Scanner
C. use Scanner
D. add Scanner
import java.util.Scanner; at
the top of your program.
Question 20
What is Java class name rule?
A. All lowercase
B. Starts with uppercase
C. Starts with number
D. Contains spaces
Complete Answer Key
| Q.No. | Answer | Q.No. | Answer |
|---|---|---|---|
| 1 | B | 11 | B |
| 2 | C | 12 | B |
| 3 | B | 13 | B |
| 4 | B | 14 | B |
| 5 | C | 15 | B |
| 6 | D | 16 | B |
| 7 | B | 17 | C |
| 8 | C | 18 | B |
| 9 | C | 19 | B |
| 10 | B | 20 | B |
Quick Revision Notes
| Concept | Key Point |
|---|---|
| Variable | Named storage in memory |
| int | Whole numbers |
| double | Decimal numbers |
| char | Single character |
| String | Text (sequence of characters) |
| boolean | true or false |
| = | Assignment operator |
| == | Comparison operator |
| % | Modulo (remainder) |
| Scanner | For input in Java |
| System.out.println | For output in Java |
| IDE | Integrated Development Environment |
| BlueJ | Java IDE for beginners |
| Compilation | Code → Machine language |
Quick Tips for MCQs
How to Ace MCQs
- ⭐ Read question carefully.
- ⭐ Check all 4 options.
- ⭐ Look for keywords in the question.
- ⭐ Eliminate wrong ones.
- ⭐ Verify with logic.
- ⭐ Practice more MCQs.
- ⭐ Learn from mistakes.
- ⭐ Don't rush — think first.
Scoring Guide
| Score | Grade | Comment |
|---|---|---|
| 90-100 | A+ Excellent! | Java Master! 🏆 |
| 75-89 | A Very Good! | Strong knowledge! 🌟 |
| 60-74 | B Good! | Well done! 👍 |
| 50-59 | C Average | Keep learning! 📚 |
| Below 50 | Needs Practice | Review the chapter! 💪 |
Did You Know?
Fun Fact
Java was created by James Gosling in 1995! Today it runs on over 3 billion devices worldwide — from smartphones to servers to smart TVs. The Java logo is a coffee cup because it was named after Java coffee!
Sample Programs (Practice)
Program 1: Hello World
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Program 2: Add Two Numbers
import java.util.Scanner;
public class AddNumbers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter first number: ");
int a = sc.nextInt();
System.out.print("Enter second number: ");
int b = sc.nextInt();
int sum = a + b;
System.out.println("Sum = " + sum);
}
}
Frequently Asked Questions
Q1. How do I remember all the operators?
Practice! Write small programs using each operator. Create flashcards for quick review.
Q2. What's the difference between int and double?
int stores whole numbers (like 5, 100). double
stores decimal numbers (like 5.5, 99.99).
Q3. Why does 10/3 give 3, not 3.33?
Because both are integers. Integer division truncates the
decimal. Use 10.0/3 or 10/3.0 to
get 3.33.
Q4. What if I forget to import Scanner?
You'll get a compilation error. Always add
import java.util.Scanner; at the top.
Q5. Should I always start class name with uppercase?
Yes! It's a Java convention (PascalCase). Examples: HelloWorld, StudentName.
Q6. What's the difference between = and ==?
= assigns a value (x = 5). ==
compares two values (x == 5).
Q7. How can I improve my score?
Practice more programs, understand concepts thoroughly, and review your mistakes.
Q8. Is BlueJ the only IDE for Java?
No! There are many: IntelliJ IDEA, Eclipse, NetBeans, VS Code. BlueJ is best for beginners.
Key Takeaways
- Programming = writing instructions for computers.
- Java is a popular programming language.
- Variables store values; identifiers name them.
- 5 data types: int, double, char, String, boolean.
- Operators: arithmetic (+ - * / %), assignment (=), comparison (==).
- Scanner for input; System.out.println for output.
- Compilation converts code to machine language.
- BlueJ is a Java IDE for beginners.
- Class names start with uppercase.
- Practice makes perfect!
Key Takeaway
MCQs test both theory and practical
knowledge! Practice regularly to master
programming!
Congratulations on completing this quiz! Whether you
scored 100 or need more practice, every question you
answer builds your programming skills. Keep coding, keep
learning!
Test Your Knowledge — Think, Code and
Grow!
⭐ CODE SMART, THINK CLEAR, WRITE BETTER! ⭐
Best of Luck! Think carefully. Answer
confidently. You will do great! 👍😊
Flowchart → Visual Thinking → Smart Solutions → Better
Results! 🚀
Master This Topic with Smart Practice
Reinforce what you just learned by solving high-quality MCQs. Improve accuracy, boost confidence, and prepare like a topper.
Home & Online Tuition
Learn from an experienced tutor with personalized guidance.
Available Locations
Expert Home & Online Tuition
Personalized one-to-one tuition that focuses on concept building, practical learning, problem-solving skills, and excellent academic performance. Suitable for school students looking for structured, interactive, and result-oriented learning.
Subjects We Teach
Why Choose Our Tuition?
✅ Concept-Based Learning
✅ Practical Examples
✅ Weekly Tests
✅ Doubt Solving Sessions
✅ Practice Worksheets
✅ MCQ & Assignments
✅ Exam Preparation
✅ Flexible Class Timings