PROGRAMMING FINAL EXAM QUESTIONS AND
ANSWERS SOLVED CORRECTLY LATEST UPDATE
GRADED A+
Question 1.
What must every C program have?
ANSWER
Main
Question 2.
Every statement in C must end with a...
ANSWER
semicolon(;)
Question 3.
What is NOT a valid integer value?
ANSWER
any decimal point because they are FLOATS
Question 4.
What is an INVALID identifier (variable name)?
ANSWER
ex: 5test (because it begins with a number)
ex: _test (this works, but it is not recommended)
,Question 5.
What is an iteration/loop statement?
ANSWER
- do...while
- for
if and if...else are NOT looping statements!
Question 6.
How many times will the following program print hello?
i = 1;
while (i<=10)
{ printf("hello"); }
ANSWER
An infinite amount of times -->
because there is no increment and the condition is always true
Question 7.
Consider the following correct segment of a correct C program:
p=2;
while (p<1000)
{ p = 2*p; }
What is the value of p AFTER this while loop completes its execution?
ANSWER
1024
because the numbers are always going to end in even digits, and anything higher than in
the thousands is incorrect because of the condition
Question 8.
An uninitialized variable contains _________________.
ANSWER
the value last stored in the memory location reserved for that variable
, Question 9.
What is the FINAL value of x after performing the following operations?
int x = 21;
double y = 6;
double z = 14;
y = x/z;
x = 5.5*y;
ANSWER
8.25
(double = doubling the float)
when you're diving an integer by a float, the answer is a float.
Question 10.
Having a loop within a loop is known as...
ANSWER
nesting
Question 11.
Which assignment expression is equivalent to c = c/2?
a. c / = 2
b. c / c = 2
c. c /= 2
d. c =/ 2
ANSWER
C
Question 12.
What statement is used to skip the remainder of the body of an iteration statement and proceed
with the next iteration of the loop?
ANSWER
continue
(break kills the whole thing and jumps AFTER the loop)
ANSWERS SOLVED CORRECTLY LATEST UPDATE
GRADED A+
Question 1.
What must every C program have?
ANSWER
Main
Question 2.
Every statement in C must end with a...
ANSWER
semicolon(;)
Question 3.
What is NOT a valid integer value?
ANSWER
any decimal point because they are FLOATS
Question 4.
What is an INVALID identifier (variable name)?
ANSWER
ex: 5test (because it begins with a number)
ex: _test (this works, but it is not recommended)
,Question 5.
What is an iteration/loop statement?
ANSWER
- do...while
- for
if and if...else are NOT looping statements!
Question 6.
How many times will the following program print hello?
i = 1;
while (i<=10)
{ printf("hello"); }
ANSWER
An infinite amount of times -->
because there is no increment and the condition is always true
Question 7.
Consider the following correct segment of a correct C program:
p=2;
while (p<1000)
{ p = 2*p; }
What is the value of p AFTER this while loop completes its execution?
ANSWER
1024
because the numbers are always going to end in even digits, and anything higher than in
the thousands is incorrect because of the condition
Question 8.
An uninitialized variable contains _________________.
ANSWER
the value last stored in the memory location reserved for that variable
, Question 9.
What is the FINAL value of x after performing the following operations?
int x = 21;
double y = 6;
double z = 14;
y = x/z;
x = 5.5*y;
ANSWER
8.25
(double = doubling the float)
when you're diving an integer by a float, the answer is a float.
Question 10.
Having a loop within a loop is known as...
ANSWER
nesting
Question 11.
Which assignment expression is equivalent to c = c/2?
a. c / = 2
b. c / c = 2
c. c /= 2
d. c =/ 2
ANSWER
C
Question 12.
What statement is used to skip the remainder of the body of an iteration statement and proceed
with the next iteration of the loop?
ANSWER
continue
(break kills the whole thing and jumps AFTER the loop)