C++ Institute CPA Certified Associate Programmer (CPA-21-02) Certification Sample Questions

CPA Certified Associate Programmer Dumps, CPA-21-02 Dumps, CPA-21-02 PDF, CPA Certified Associate Programmer VCE, C++ Institute CPA-21-02 VCE, C++ Institute CPA - C++ PDFThe purpose of this Sample Question Set is to provide you with information about the CPA - C++ Certified Associate Programmer exam. These sample questions will make you very familiar with both the type and the difficulty level of the questions on the CPA-21-02 certification test. To get familiar with real exam environment, we suggest you try our Sample C++ Institute CPA Certified Associate Programmer Certification Practice Exam. This sample practice exam gives you the feeling of reality and is a clue to the questions asked in the actual CPA - C++ Certified Associate Programmer certification exam.

These sample questions are simple and basic questions that represent likeness to the real C++ Institute CPA-21-02 exam questions. To assess your readiness and performance with real time scenario based questions, we suggest you prepare with our Premium C++ Institute CPA Certified Associate Programmer Certification Practice Exam. When you solve real time scenario based questions practically, you come across many difficulties that give you an opportunity to improve.

C++ Institute CPA-21-02 Sample Questions:

01. The complete program below includes <iostream> and <string>.
std::string s = "a\tb\n";
std::cout << s.size();
What output does the program produce?
a) 6
b) 5
c) 4
d) 2
 
02. Four lines mentioning the same function appear in a program.
Which one invokes it?
a) total = area(3, 4);
b) int area(int w, int h);
c) int area(int w, int h) { return w * h; }
d) extern int area(int, int);
 
03. A student proposes four ways of declaring the entry point of a C++ program.
Which one is not a valid form of main()?
a) int main()
b) void main()
c) int main(int argc, char *argv[])
d) int main(void)
 
04. Two pointer declarations differ only in where const appears.
int n = 0, m = 0;
const int *p = &n;
int *const q = &n;
Which statement describes them correctly?
a) p may be written through but not reseated; q may be reseated but not written through
b) Both forbid reseating and both forbid writing through, so the two are equivalent
c) p may be reseated but not written through; q may be written through but not reseated
d) q is rejected, because const may not follow the star in a declaration
 
05. A hierarchy defines the two classes below, and a caller writes Stream *s = &file; s->flush();.
class Stream { public: void flush(); };
class FileStream : public Stream { public: void flush(); };
Which function runs, and why?
a) FileStream::flush, because the pointer addresses a FileStream object
b) Neither, because the two declarations conflict and the program is rejected
c) FileStream::flush, because a derived function always hides and replaces the base one
d) Stream::flush, because a non-virtual call is always resolved from the pointer's declared type
 
06. Two std::string objects are compared with the member function a.compare(b).
What does the call return when the two strings are equal?
a) 1
b) 0
c) true
d) The length of the common prefix
 
07. Four literals are written for the same intended value.
Which literal does not denote 255?
a) 0xFF
b) 0377
c) 0255
d) 255
 
08. Assume <iostream> is included and that the lines below execute in order.
for (int i = 0; i < 6; ++i) {
if (i % 2 == 0) continue;
std::cout << i;
}
What does the fragment print?
a) 135
b) 024
c) 13
d) Nothing, because continue in a for loop skips the increment and the loop never advances
 
09. The statements below run inside main(), with <iostream> included.
int a = 1, b = 2, c = 3;
a = b = c;
std::cout << a << b << c;
What does the fragment print?
a) 133
b) 333
c) 123
d) 223
 
10. Consider the complete program below.
#include <iostream>
#define LEVEL 2
int main() {
#if LEVEL > 2
std::cout << "high";
#elif LEVEL > 0
std::cout << "mid";
#else
std::cout << "low";
#endif
return 0;
}
What does the program print?
a) mid
b) high
c) low
d) midlow

Answers:

Question: 01
Answer: c
Question: 02
Answer: a
Question: 03
Answer: b
Question: 04
Answer: c
Question: 05
Answer: d
Question: 06
Answer: b
Question: 07
Answer: c
Question: 08
Answer: a
Question: 09
Answer: b
Question: 10
Answer: a

Note: For any error in CPA - C++ Certified Associate Programmer (CPA-21-02) certification exam sample questions, please update us by writing an email on feedback@edusum.com.

Rating: 4.9 / 5 (135 votes)