CSCE 1337 Final Review Exam Questions And Correct Answers
Is it legal to declare more than one variable in a single statement? - ANSWER True
What is the value of x after the following statements?
int x;
x = 15 % 4; - ANSWER 3
In the following code fragment, x has the value of 3.
int x = 3; - ANSWER True
The body of a while loop may never execute - ANSWER True
The integer 0 is considered true. - ANSWER False
Variable names may begin with a number. - ANSWER False
The opposite of (x >3 && x < 10) is (x < 3 && x > 10). - ANSWER False
Given the following code fragment, what is the final value of y?
int x, y;
x = -1;
y = 0;
while (x < 3)
{
y += 2;
,x += 1;
} - ANSWER 8
Given the following code fragment, which of the following expressions is always TRUE?
int x;
cin >> x; - ANSWER if (x = 1)
Loops are used when we need our program to make a choice between two or more
things. - ANSWER False
What is the final value of x after the following fragment of code executes?
int x = 0;
do
{
x++;
} while (x > 0); - ANSWER Infinite loop
Given the following code fragment, and an input value of 5, what is the output?
int x;
if (x < 3)
{
cout << "small\n";
}
else
{
if (x < 4)
{
, cout << "medium\n";
}
else
{
if (x < 6)
{
cout << "large\n";
}
else
{
cout << "giant\n";
}
}
} - ANSWER large
The body of a do-while loop always executes at least once. - ANSWER True
The opposite of less than is greater than - ANSWER False
Given the following code fragment, what is the output?
int x = 5;
if (x > 5)
cout << "x is bigger than 5. ";
cout << "That is all. ";
cout << "Goodbye\n"; - ANSWER That is all. Goodbye
Every line in a program should have a comment. - ANSWER False
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 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 Easton. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £10.87. You're not tied to anything after your purchase.