NEW
Font size
WorksheetsC Programming Unit 2 Review
Total questions: 15
Worksheet time: 8mins
What is the value of this expression using integer arithmetic:
7 / 4
1
2
1.75
What is the value of a in this code fragment
int a=3, b;
0
Nothing
3
Determine the value of this expression using integer arithmetic:
5 % 7
0
2
5
Determine the value of b in this code fragment:
int a=3, b;
b=++a;
3
4
2
Determine the value of the expression using integer arithmetic:
6 * 9 % 3 / 2
2
0
18
Determine the value of a in the second line of the code fragment:
int a=1, b=2;
a=b--;
1
0
2
Determine the value of b in the second line of the code fragment:
int a=1, b=2;
a=b--;
1
0
2
Which line of code is correct for the statement:
Add 1 variable to x.
x++;
x+1
x+x
Which line of code is incorrect for the statement:
Subtract 4 from the variable y.
y-4
y=y-4
y-=4
Which line of code is correct for the statement:
Read in a value for the integer variable num.
printf("%d", &num);
scanf("%d", num);
scanf("%d", &num);
What is the EXACT output from this code fragment:
float num=3.238;
printf("num=%.2f", num);
Number=3.2
num=3.238
num=3.24
What is the EXACT output from this code fragment:
int num=10;
if(num> 7 % 3 / 2 * 3)
printf("This is True");
else
printf("This is False");
This is True
This is False
What symbol is used in conditional operators for AND:
AND
&&
&
What will be printed on the screen from this fragment:
int num=0;
printf("%d", ++num)
0
1
2
What is the abbreviated way to write this assignment statement:
total=total+num;
t=t+n;
total+=num
total=(total+num)
