Programming Final UPDATED Exam Questions and CORRECT Answers
7 views 0 purchase
Course
Programming
Institution
Programming
Programming Final UPDATED Exam
Questions and CORRECT Answers
What must every C program have? - CORRECT ANSWER- Main
Every statement in C must end with a... - CORRECT ANSWER- semicolon(;)
What is NOT a valid integer value? - CORRECT ANSWER- any decimal point because they
are FLOATS
What is a...
Programming Final UPDATED Exam
Questions and CORRECT Answers
What must every C program have? - CORRECT ANSWER- Main
Every statement in C must end with a... - CORRECT ANSWER- semicolon(;)
What is NOT a valid integer value? - CORRECT ANSWER- any decimal point because they
are FLOATS
What is an INVALID identifier (variable name)? - CORRECT ANSWER- ex: 5test (because
it begins with a number)
ex: _test (this works, but it is not recommended)
What is an iteration/loop statement? - CORRECT ANSWER- - do...while
- for
if and if...else are NOT looping statements!
How many times will the following program print hello?
i = 1;
while (i<=10)
{ printf("hello"); } - CORRECT ANSWER- An infinite amount of times -->
because there is no increment and the condition is always true
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? - CORRECT
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
An uninitialized variable contains _________________. - CORRECT ANSWER- the value
last stored in the memory location reserved for that variable
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; - CORRECT ANSWER- 8.25
(double = doubling the float)
when you're diving an integer by a float, the answer is a float.
Having a loop within a loop is known as... - CORRECT ANSWER- nesting
Which assignment expression is equivalent to c = c/2?
a. c / = 2
b. c / c = 2
c. c /= 2
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller MGRADES. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.49. You're not tied to anything after your purchase.