WorksheetsIPC144 - Week 3
Total questions: 28
Worksheet time: 14mins
What is the size of char?
8 Bits
8 Bytes
4 Bits
4 Bytes
What is the size of an int? (in a 32-bit environment)
4 Bytes
16 Bytes
2 Bytes
8 Bytes
Which is an example of postfix operator?
i++
++i
Which of the following is a prefix operator?
++i
i++
What does "const" keyword signify in a declaration? (ex. "const int x = 7")
That "x" can be changed after initialization
That "x" cannot be changed after initialization
That "x" is a super int
Select the variable which doesn't comply with naming conventions
int auto = 7;
int 8auto = 7;
int auto_word = 7;
int _auto = 7;
What does the backslash (\) signify when placed before a symbol?
A hack in the mainframe
An entrance sequence
An escape sequence
\n signifies:
A new line
A program exit
A tab
An alarm
The instruction for accepting data from the user is:
scanf(format, address);
whatDoYouWantToWriteHere(format, typeGarbageHere);
scanf(address);
input(userInput);
Which specifier.... uh, specifies a char?
%c
%d
%f
%lf
Which specifier is used for an int and/or short?
%c
%d
%f
%lf
Which specifier is used for a float?
%c
%d
%f
%lf
How do you get the address variable "x"?
&x
x.address
x&
x->address
Which of the following will successfully accept user input into "x", an integer?
scanf("%c", &x);
scanf("%d", &x);
scanf("%d", x);
scanf(&x);
You've declared "x int;" in your program. How do you assign a value to x?
4 = x;
x = 4;
x == 4;
x === 4;
How do you "print" an expression (a variable) to the screen?
print(format, expression);
printf(format, expression);
printout(expression);
How do you print "hello" with quotation marks?
printf("hello");
printf("\"hello\"");
printf(hello);
printf(""hello"");
Which "relational expression" means both "operands" are equal?
==
>
!=
<=
Which "relational expression" means left "operand" is less than right operand?
>
<
==
<=
Which "relational expression" means two "operands" are not equal?
=
==
!=
===
Which "arithmetic expression" multiples the left "operand" by the right "operand"?
x
*
/
.
Which "arithmetic expression" adds two "operands" together?
+
=
-
*
Which "relational expression" means the left "operand" is greater than or equal to the right "operand"?
<
>
>=
!=
Which "logical expression" checks if both "operands" are true?
operand && operand
operand || operand
operand == operand
operand != operand
The arithmetic operator % gives:
the remainder of the division of left operand by right operand
the product of the left and right operands
the percentage of the right operand
the number of times the left operand is divisible by the right operand
What does "casting" mean?
Changing a variable into a constant
Checking what type a variable is
Converting one type to another type
Which option successfully casts "minutes" as a float?
hours = (float)minutes / 60;
hours = float * minutes / 60;
hours = minutes / 60;
hours = minutes(float) / 60;
int x = 8;
int y = 9;
Select ALL expressions that yield 1 ("true")
x == 8 && y == 777
x == 8 || y == 777
x > 5
x != y
