100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CPA AnswerSheet Programming Essentials in C++ Chapter 3 Assessment

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
02-09-2022
Written in
2021/2022

CPA AnswerSheet Programming Essentials in C++ Chapter 3 Assessment

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Course

Document information

Uploaded on
September 2, 2022
Number of pages
10
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

1. What is the output of the following program?
#include <iostream>

using namespace std;

int main() {
int t[3] = { 3, 2, 1 }, *ptr = t + 1;
(*(ptr + 1))++;
*ptr++;
cout << t[1] << t[2];
return 0;
}

 33
 22
 32
 23
2. What is the output of the following program?
#include <iostream>
using namespace std;

int main() {
float x = 3.14, *p = &x;
p[0] = ++x;
cout << x;
return 0;
}

 0.0
 6.28
 4.14
 3.14
3. What is the output of the following program?
#include <iostream>
using namespace std;

int main() {
int tab[5] = { 1, 2, 4, 8, 16 };
int *p1 = tab, *p2 = tab + 4;
for(int *p = p1 + 1; p < p2; p++)
*p = p[-1] * 2;
cout << tab[1] << tab[2];
return 0;
}

 12
 01

,  24
 48
4. What is the output of the following program?#include
<iostream>
using namespace std;int main() {
float f[2];
float *p1 = f, *p2 = p1 + 1;
cout << (p2 – p1) / sizeof(float);
return 0;
}

 0
 2
 1
 3
5. What is the output of the following program?#include
<iostream>
using namespace std;float fun(float arg) {
return arg * arg + arg + 1;
}

int main() {
cout << fun(fun(1.0));
return 0;
}

 16
 10
 7
 13
6. What is the output of the following program?
#include <iostream>
using namespace std;

int fun(float a, float b) {
return a / b;
}

int main() {
cout << fun(fun(1.0,2.0),fun(2.0,1.0));
return 0;
}

 0
 -1
 1
$4.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
arviemontemayor

Document also available in package deal

Get to know the seller

Seller avatar
arviemontemayor AMACC
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
3 year
Number of followers
0
Documents
39
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions