Which of the following pairs of declarations will cause an error message?
I. double x = 14.7;
int y = x;
II. double x = 14.7;
int y = (int) x;
III. int x = 14;
double y = x;
Java Basics #1

Quiz
•
Computers
•
10th - 12th Grade
•
Hard
Jennifer Hoagland
Used 90+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
None
I only
II only
III only
I and III only
2.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What output will be produced by:
System.out.print("\\* This is not\n a comment *\\"):
* This is not a comment *
\* This is not a comment *\
* This is not
a comment *
\\* This is not
a comment *\\
\* This is not
a comment *\
3.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Refer to the following code fragment:
double answer = 13 / 5;
System.out.println("13 / 5 = " + answer);
The output is:
13 / 5 = 2.0
The programmer intends the output to be:
13 / 5 = 2.6
Which of the following replacements for the first line of code will NOT fix the problem?
double answer = (double) 13 / 5;
double answer = 13 / (double) 5;
double answer = 13.0 / 5;
double answer = 13 / 5.0;
double answer = (double) (13 / 5);
4.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
What value is stored in result if:
int result = 13 - 3 * 6 / 4 % 3;
-5
0
13
-1
12
5.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Suppose that addition and subtraction had higher precedence than multiplication and division. Then the expression:
2 + 3 * 12 / 7 - 4 + 8
would evaluate to which of the following?
11
12
5
9
-4
6.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Which is true of the following boolean expression, given that x is a variable of type double?
3.0 == x * (3.0 / x)
It will always evaluate to false.
It may evaluate to false for some values of x.
It will evaluate to false only when x is zero.
It will evaluate to false only when x is very large or very close to zero.
It will always evaluate to true.
7.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Which of the following will evaluate to true only if boolean expressions
A, B, and C are all false?
!A && !(B && !C)
!A || !B || !C
!(A || B || C)
!(A && B && C)
!A || !(B || !C)
8.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Assume that a and b are integers. The boolean expression
!( a <= b) && (a * b > 0)
will always evaluate to true given that
a = b
a > b
a < b
a > b and b > 0
a > b and b < 0
9.
MULTIPLE CHOICE QUESTION
15 mins • 1 pt
Given that a, b, and c are integers, consider the boolean expression
(a < b) || !((c == a * b) && (c < a))
Which of the following will guarantee that the expression is true?
c < a is false.
c < a is true.
a < b is false.
c == a * b is true.
c == a * b is true, and c < a is true.
Similar Resources on Quizizz
8 questions
Functii quiz

Quiz
•
9th - 12th Grade
7 questions
Tutorial 6 - Fundamental of C Programming

Quiz
•
9th - 12th Grade
7 questions
Java Basics #2

Quiz
•
10th - 12th Grade
10 questions
T_4.2 Identifier, Data Types, Operators & Expressions

Quiz
•
12th Grade - University
12 questions
Unit 7 - ArrayList - Test Review

Quiz
•
9th - 12th Grade
10 questions
QBASIC Programming

Quiz
•
5th - 10th Grade
10 questions
BAHASA C++

Quiz
•
11th Grade
10 questions
Programming

Quiz
•
1st - 10th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University