Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Ekkoo
E
Ekkoo
Community Contributor
Quizzes Created: 4 | Total Attempts: 2,560
| Attempts: 184 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Which of the following is NOT a reserved word in Java?

Explanation

In Java, "friend" is not a reserved word. Reserved words are predefined keywords that have special meanings and cannot be used as identifiers (such as variable names or class names) in the program. "import", "finally", and "goto" are all examples of reserved words in Java.

Submit
Please wait...
About This Quiz
Java Quizzes & Trivia

ITEMP Java Quiz 3 assesses knowledge of Java programming fundamentals. It covers topics such as reserved words, data types, variable initialization, and value ranges, crucial for beginners and intermediate learners aiming to solidify their Java programming skills.

Tell us your name to personalize your report, certificate & get on the leaderboard!
2.
  1. int answer; 
  2. answer = 50;
  3. answer = answer+1;
What will be the value assigned to variable answer after executing this code?

Explanation

The value assigned to the variable answer after executing this code will be 51. This is because the code first assigns the value 50 to the variable answer, and then adds 1 to it using the += operator. This results in answer being incremented by 1, making it equal to 51.

Submit
3. Which of the following variable names will be rejected by the Java compiler?

Explanation

Variable names in Java cannot start with a number. They must begin with a letter, an underscore, or a dollar sign. Therefore, the variable name "2ndletter" will be rejected by the Java compiler.

Submit
4. How many bits does a Java double primitive value use?

Explanation

A Java double primitive value uses 64 bits. A double is a data type in Java that represents a decimal number with double precision. It is stored using 64 bits, which allows for a wide range of values and a high level of precision. This allows for accurate calculations and storage of decimal numbers in Java programs.

Submit
5. Which of the following statements declaring and initializing boolean primitive variables would not be rejected by the Java compiler?

Explanation

The correct answer is "boolean flag = true;". In Java, boolean primitive variables can only be assigned the values "true" or "false" in lowercase letters. The other options are incorrect because they either use the wrong case for the boolean values or use the Boolean wrapper class instead of the boolean primitive type.

Submit
6.
  1. lightspeed = 1816000;
  2. days = 1000;
  3. seconds = days * 24 * 60 * 60;
  4. distance = lightspeed * seconds;
When this block of code is executed, what will be the value of variable seconds after the execution of line 3 ?

Explanation

The variable "seconds" will have a value of 86400000 after the execution of line 3. This is because the variable "days" is multiplied by 24 (hours in a day), then by 60 (minutes in an hour), and finally by 60 (seconds in a minute), resulting in the total number of seconds in 1000 days.

Submit
7. Which of the following integer primitive types can correctly represent a value of 65000?

Explanation

The int primitive type can correctly represent a value of 65000. Integers are whole numbers without any decimal points, and the int type can store values up to 2,147,483,647. Since 65000 falls within this range, it can be accurately represented using the int data type.

Submit
8. Which of the following uses the same number of bits as the int primitive variable?

Explanation

The float data type in Java uses the same number of bits as the int data type, which is 32 bits. Both int and float can store 32 bits of information, although they represent different types of values. Int is used for storing whole numbers, while float is used for storing decimal numbers with a wider range and less precision.

Submit
9.
  1. byte b = 50;
  2. b = b * 2; What will happen if you try to compile this block of code?

Explanation

The code will give an error because the result of the multiplication operation is an int, and it cannot be directly assigned to a byte variable.

Submit
10. Which of the following is the range of values that a byte can store?

Explanation

A byte is a data type in computer programming that can store 8 bits of information. In binary, the leftmost bit is used to represent the sign of the number, with 0 indicating a positive number and 1 indicating a negative number. Therefore, in the range of values that a byte can store, the leftmost bit can be either 0 or 1, resulting in a range of -128 to 127.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 17, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 20, 2011
    Quiz Created by
    Ekkoo
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following is NOT a reserved word in Java?
Int answer;  ...
Which of the following variable names will be rejected by the Java...
How many bits does a Java double primitive value use?
Which of the following statements declaring and initializing boolean...
Lightspeed = 1816000;...
Which of the following integer primitive types can correctly represent...
Which of the following uses the same number of bits as the int...
Byte b = 50; ...
Which of the following is the range of values that a byte can store?
Alert!

Advertisement