This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1Which of the following is not a valid variable name in Java language?
Option D
Java naming convention is a mechanism to follow as you decide what to name your identifiers such as class, package, variable, constant, method, etc.
Rules For Writing Variable Name:
The variable name rate-of-taxi contains hyphens (-), which Java treats as subtraction operators and it is invalid variable name.
Q: 2Size of “int” data type in Java language is—
Option D
In Java, the size of each primitive data type is fixed, regardless of the operating system or machine architecture. The int data type always occupies 32 bits (4 bytes) of memory. This consistency is a key feature of Java Portability across different platforms.

| DATA TYPE | SIZE | DEFAULT VALUE | WRAPPER CLASS |
|---|---|---|---|
| boolean | 1 Bit | false | Boolean |
| char | 2 Byte | ‘u0000’ | Character |
| byte | 1 Byte | 0 | Byte |
| short | 2 Byte | 0 | Short |
| int | 4 Byte | 0 | Integer |
| long | 8 Byte | 0 | Long |
| float | 4 Byte | 0.0 | Float |
| double | 8 Byte | 0.0 | Double |
You have reached the end of this topic. Continue learning with the next topic below.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.