Java 2

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 Saifullah
S
Saifullah
Community Contributor
Quizzes Created: 3 | Total Attempts: 2,074
| Attempts: 1,073 | Questions: 42
Please wait...
Question 1 / 42
0 %
0/100
Score 0/100
1. Which of the following is the newline character?

Explanation

REF: 80

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

Java 2 is a quiz designed to assess fundamental Java programming skills. It includes questions on variable manipulation, commenting syntax, and basic programming concepts, focusing on enhancing practical... see moreJava coding abilities. see less

2. Suppose that x and y are int variables and x = 10 and y = 20. After the statement: x = x + y; executes, the value of x is ____.

Explanation

REF: 54

Submit
3. Which of the following is the correct syntax for commenting in Java?

Explanation

REF: 91

Submit
4. Which of the following is NOT a reserved word in Java?

Explanation

REF: 34

Submit
5. Which of the following is a valid int value?

Explanation

REF: 37

Submit
6. The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.

Explanation

REF: 33

Submit
7.                   Suppose that x, y and z are int variables. The expression x(y+z) in Java is written as ____.

Explanation

REF: 40

Submit
8.                   Suppose that x, y, z, and w are int variables. The expression x(y-z)/w in Java is written as ____.

Explanation

REF: 40

Submit
9. The declaration int a, b, c; is equivalent to which of the following?

Explanation

REF: 91 | 92

Submit
10.                   What is the output of the following statement?   System.out.println("Welcome \n Home");

Explanation

REF: 76

Submit
11. The expression (double)(6 + 2) evaluates to ____.

Explanation

REF: 49 | 50

Submit
12. The expression (int)6.9 + (int)7.9 evaluates to ____.

Explanation

REF: 49 | 50

Submit
13.                   Suppose that x = 5 and y = 6. What is the output of the following Java statement?   System.out.println("Sum of "   + x     + " and "     + y      + " = "   + (x + y));

Explanation

REF: 72 | 75

Submit
14. Suppose that x is an int variable. What is the value of x after the following statement executes: x = 15 + (int)(10.5) / 2;.

Explanation

REF: 49 | 50

Submit
15. The length of the string "computer science" is:

Explanation

REF: 51

Submit
16. The expression (int)9.9 evaluates to ____.

Explanation

REF: 49 | 50

Submit
17. The value of the expression 26 + 14 / 3 + 1 is ____.

Explanation

REF: 45

Submit
18. The value of the expression 17 % 7 is ____.

Explanation

REF: 40

Submit
19.                  Which of the following is a legal identifier?

Explanation

REF: 34

Submit
20. Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ____.

Explanation

REF: 70 | 71

Submit
21. Which of the following is NOT a special symbol in Java?

Explanation

REF: 33

Submit
22. The value of the expression 26 – 14 % 3 + 1 is ____.

Explanation

REF: 41

Submit
23. The value of the expression 1 + 5 % 3 is ____.

Explanation

REF: 45

Submit
24. Suppose that alpha is a double variable. What is the value of alpha after the following statement executes: alpha = 11.5 + (double)(15) / 2;

Explanation

REF: 49 | 50

Submit
25.                   Suppose x = 2 and y = 3.  If the statement   x *= y;   is executed once, what is the value of x?

Explanation

REF: 93

Submit
26.                    Operators that have two operands are called ____.

Explanation

REF: 45

Submit
27. Which of the following is a valid Java identifier?

Explanation

REF: 34

Submit
28.                   Suppose that x = 5 and y = 6. What is the output of the following Java statement?   System.out.println("Sum of " + x + " and " + y + " = "   + x + y);          

Explanation

REF: 72 | 75

Submit
29. The value of the expression 44 / 10 is _____.

Explanation

REF: 40

Submit
30. The value of 3 % 9 is ___.

Explanation

REF: 40

Submit
31.                    Consider the following sequence of statements.   String str; int num1, num2; num1 = 13; num2 = 24; str = "The sum = " + num1 + num2;   What is the final value stored in str?

Explanation

REF: 72

Submit
32. ____ are executable statements that inform the user what to do.

Explanation

REF: 90

Submit
33.                    Which of the following statements about a named constant is NOT true?

Explanation

REF: 52

Submit
34. What is the floating-point notation for 25.611?

Explanation

REF: 39

Submit
35.                   Suppose x = 2 and y = 3.  If the statement   x *= y;   is executed once, what is the value of y?

Explanation

REF: 93

Submit
36. Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) ____.

Explanation

REF: 70 | 71

Submit
37. What type of Java statement(s) stores a value in a variable?

Explanation

REF: 54

Submit
38.                   Consider the following program.   // Insertion Point 1 public class CircleArea {       // Insertion Point 2     static final float PI = 3.14       public static void main(String[]args)     {        //Insertion Point 3          float r = 2.0;        float area;        area = PI * r * r;        System.out.println("Area = " + area);     }      // Insertion Point 4 }   In the above code, where do the import statements belong?

Explanation

REF: 82 | 83

Submit
39. Which of the following is a reserved word in Java?

Explanation

REF: 34

Submit
40. The value of the expression 36 – 15 % 2.0 + 1 is ____.

Explanation

REF: 46 | 47

Submit
41.                    Given   int      one; double   two; boolean  four;   Which of the following assignment statements are valid? (i)   one = 7 + 3 % 4; (ii)  2.3 + 3.5 = two; (iii) four = (2 <= 3);  

Explanation

REF: 54

Submit
42. All of the following are examples of integral data types EXCEPT ____.

Explanation

REF: 36

Submit
View My Results

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

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

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 28, 2015
    Quiz Created by
    Saifullah
Cancel
  • All
    All (42)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following is the newline character?
Suppose that x and y are int variables and x = 10 and y = 20. After...
Which of the following is the correct syntax for commenting in Java?
Which of the following is NOT a reserved word in Java?
Which of the following is a valid int value?
The ____ rules of a programming language tell you which statements are...
                 ...
                 ...
The declaration int a, b, c; is equivalent to which of the following?
                  What...
The expression (double)(6 + 2) evaluates to ____.
The expression (int)6.9 + (int)7.9 evaluates to ____.
                  Suppose...
Suppose that x is an int variable. What is the value of x after the...
The length of the string "computer science" is:
The expression (int)9.9 evaluates to ____.
The value of the expression 26 + 14 / 3 + 1 is ____.
The value of the expression 17 % 7 is ____.
                ...
Suppose that alpha and beta are int variables. The statement alpha =...
Which of the following is NOT a special symbol in Java?
The value of the expression 26 – 14 % 3 + 1 is ____.
The value of the expression 1 + 5 % 3 is ____.
Suppose that alpha is a double variable. What is the value of alpha...
                  Suppose...
                  ...
Which of the following is a valid Java identifier?
                 ...
The value of the expression 44 / 10 is _____.
The value of 3 % 9 is ___.
                  ...
____ are executable statements that inform the user what to do.
                  ...
What is the floating-point notation for 25.611?
                 ...
Suppose that alpha and beta are int variables. The statement alpha =...
What type of Java statement(s) stores a value in a variable?
                 ...
Which of the following is a reserved word in Java?
The value of the expression 36 – 15 % 2.0 + 1 is ____.
                  ...
All of the following are examples of integral data types EXCEPT ____.
Alert!

Advertisement