Multiple Choice
What has the same result as
counter++
?What is the result of
89 % 4
?What is the result of
number
afterint number = 7.0 / 2.0;
?What is a valid value for a
boolean
?Suppose you want to store the age of your dog in a variable (the years). What would be the most obvious datatype for this?
What is the result of
11 / 5
?What is the correct definition of a primitive datatype?
Which of the data types below is not a primitive datatype?
What is the result of
83 % 4
?What is the resulting value in
q
?int x = 5; int y = 2; double q = (double) x / y;
What is the most correct and complete definition of a variable?
Why are the operators
+
,-
,*
,/
, ... called binary operators?Which of the following code blocks makes use of compound operators?
// Code block A int x = ( 25 / 3 ) * (15 % 4);
// Code block B int z = 0; for (int i = 0; i < 5; i++) { int y = i + 5; z++; }
// Code block C double vatPercent = 21; double priceTag = 55; double vat = priceTag * vatPercent / 100;
// Code block D int x = 32; int y = 88; while (x <= 1000) { x += 5; }
Which of the following code snippets will not result in the value of
b
incrementing with1
?int x = 15; int b = 3; x = b++;
int x = 15; int b = 3; x += (++b);
int x = 15; int b = 3; x = (b + 1);
int x = 15; int b = 3; b += 1;
Last updated