C++ & OBJECTED ORIENTED PROGRAMMING EXAM 1 QUESTIONS & ANSWERS 2022C (TCO
4)
What
is the
result
of 5
% 7?
(7
points)
Week 12, Final Attempt 3(Current Exam)
0
2
5
7
Instructor Explanation:Malik, pages 39–40
MC(TCO 4) A variable declared before and outside all function blocks(7
poin...
c tco 4 what is the result of 5 7 7 points week 12
final attempt 3current exam 0 2 5 7 instructor explanationmali
Written for
C++ & OBJECTED ORIENTED PROGRAMMING
All documents for this subject (2)
Seller
Follow
TestGen
Reviews received
Content preview
MC Week 12, Final Attempt 3(Current Exam)
(TCO
4)
What
is the
result
of 5
% 7?
(7
points)
0
2
5
7
Instructor Explanation: Malik, pages 39–40
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) A variable declared before and outside all function blocks (7
points)
is visible only in main.
is visible to all functions.
is visible to all functions except main.
is not visible to any functions.
Instructor Explanation: Malik, pages 50–65
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) What is the value of data after the following code
executes?
unsigned char data = 0xA5;
data = data & 0xF0;(7 points)
0xA0
0xF0
0xF5
0x5A
Instructor Explanation: Malik, pages 32–42
, MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) What is the bit pattern in data after the following statements
execute?
unsigned int data = 10;
data = data | 0x0B;
data = data << 1;(7 points)
0x314
0x154
0x342
0x156
Instructor Explanation: Malik, pages 32–42
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) Why does this code snipper give a compile error?
int loopCounter = 0;
int numberOfScores = 20;
while (loopcounter < numberOfScores)
cout << “\nInside the loop”;(7 points)
The value of the control loop control variable does not change the loop body.
The curly brackets are missing around the loop body.
The loopCounter variable is not spelled consistently.
All of the above
Instructor Explanation: Malik, pages 32–42
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) Which of the following is not a C++ logical operator? (7 points)
#
&&
││
!
Instructor Explanation: Malik, pages 57–67
, MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) What is the value of i after the following code fragment
executes?
int i = 2;
int k = 5 ;
i *= k + 1;(7 points)
7
11
12
14
Instructor Explanation: Malik, pages 57–67
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) Which looping statement is best if the number of iterations
is known?(7 points)
If/Else
For
While
Do/While
Instructor Explanation: Malik, pages 57–67
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) Which operation in the following expression will be
performed first?
c = a++ / b + 5;(7 points)
a
a/b
assignment to c
b+5
Instructor Explanation: Malik, pages 57–67
, MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) What is the value stored in variable c, after the execution of
the following statement?
int a=5, b=2, c;
c = ++a / b + 5;(7 points)
7.5
8
7
0
Instructor Explanation: Malik, pages 57–67
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4)
What is
the value
stored in
variable c,
after the
execution
of the
following
statement?
int a=5,
b=2, c;
c = a++ / b
+ 5;(7 points)
7.5
8
7
0
Instructor Explanation: Malik, pages 57–67
MC Week 12, Final Attempt 3(Current Exam)
(TCO 4) If firstName and lastName are string object variables,
which statement can be used to combine (append or
concatenate) the two into a single string variable?(7 points)
fullName = firstName + lastName;
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 TestGen. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $15.49. You're not tied to anything after your purchase.