SlideShare a Scribd company logo
1 of 13
Download to read offline
Demo Edition
© 2012 - 2013 Test Killer, LTD All Rights Reserved
C++ Certified Associate Programmer
Exam: CPA
CPA
1 http://www.troytec.com
QUESTION: 1
What will the variable "age" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
A () { age=5; };
};
class B : public A {
string name;
public:
B () { name="Bob"; };
void Print() {
cout << name << age;
}
};
A. public
B. private
C. protected
D. None of these
Answer: A
QUESTION: 2
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class complex{
double re, im;
public:
complex() : re(1),im(0.4) {}
complex operator?(complex &t);
void Print() { cout << re << " " << im; }
};
complex complex::operator? (complex &t){
complex temp;
temp.re = this?>re ? t.re;
temp.im = this?>im ? t.im;
return temp;
CPA
2 http://www.troytec.com
}
int main(){
complex c1,c2,c3;
c3 = c1 ? c2;
c3.Print();
}
A. It prints: 1 0.4
B. It prints: 2 0.8
C. It prints: 0 0
D. It prints: 1 0.8
Answer: C
QUESTION: 3
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class complex{
double re;
double im;
public:
complex() : re(0),im(0) {}
complex(double x) { re=x,im=x;};
complex(double x,double y) { re=x,im=y;}
void print() { cout << re << " " << im;}
};
int main(){
complex c1;
c1 = 3.0;
c1.print();
return 0;
}
A. It prints: 0 0
B. It prints: 1 1
C. It prints: 3 3
D. Compilation error
Answer: C
CPA
3 http://www.troytec.com
QUESTION: 4
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
void fun(int);
int main()
{
int a=0;
fun(a);
return 0;
}
void fun(int n)
{
if(n < 2)
{
fun(++n);
cout << n;
}
}
A. It prints: 21
B. It prints: 012
C. It prints: 0
D. None of these
Answer: A
QUESTION: 5
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int s(int n);
int main()
{
int a;
a = 3;
cout << s(a);
return 0;
}
int s(int n)
{
if(n == 0) return 1;
CPA
4 http://www.troytec.com
return s(n?1)*n;
}
A. It prints: 4
B. It prints: 6
C. It prints: 3
D. It prints: 0
Answer: B
QUESTION: 6
What will be the output of the program?
#include <iostream>
using namespace std;
int fun(int);
int main()
{
cout << fun(5);
return 0;
}
int fun(int i)
{
return i*i;
}
A. 25
B. 5
C. 0
D. 1
Answer: A
QUESTION: 7
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
#define FUN(arg) if(arg) cout<<"Test";
int main()
{
int i=1;
CPA
5 http://www.troytec.com
FUN(i<3);
return 0;
}
A. It prints: 0
B. It prints: T
C. It prints: T0
D. It prints: Test
Answer: D
QUESTION: 8
What will the variable "y" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : private A {
string name;
public:
void Print() {
cout << name << age;
}
};
A. public
B. private
C. protected
D. None of these
Answer: B
QUESTION: 9
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
CPA
6 http://www.troytec.com
{
float x=3.5,y=1.6;
int i,j=2;
i = x + j + y;
cout << i;
return 0;
}
A. It prints: 7
B. It prints: 6
C. It prints: 7,1
D. Compilation error
Answer: A
QUESTION: 10
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(){
int i = 1;
if (i==1) {
cout << i;
} else {
cout << i-1;
}
return 0;
}
A. It prints: 0
B. It prints: 1
C. It prints: -1
D. It prints: 2
Answer: B
QUESTION: 11
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
CPA
7 http://www.troytec.com
using namespace std;
class complex{
double re, im;
public:
complex() : re(1),im(0.4) {}
complex operator+(complex &t);
void Print() { cout << re << " " << im; }
};
complex complex::operator+ (complex &t){
complex temp;
temp.re = this?>re + t.re;
temp.im = this?>im + t.im;
return temp;
}
int main(){
complex c1,c2,c3;
c3 = c1 + c2;
c3.Print();
}
A. It prints: 1 0.4
B. It prints: 2 0.8
C. It prints: 0 0
D. Garbage value
Answer: B
QUESTION: 12
What happens when you attempt to compile and run the following code?
#include <cstdlib>
#include <iostream>
using namespace std;
float* sum(float a,float b);
float* sum(float a,float b)
{
float *f = new float;
*f = a+b;
return f;
}
int main()
{
float a,b,*f;
a = 1.5; b = 3.4;
CPA
8 http://www.troytec.com
f = sum(a,b);
cout<<*f;
return 0;
}
A. It prints: 0
B. It prints: 4.9
C. It prints: 5
D. It prints: 4
Answer: B
QUESTION: 13
Which statement should be added in the following program to make work it
correctly?
using namespace std;
int main (int argc, const char * argv[])
{
cout<<"Hello";
}
A. #include<stdio.h>
B. #include<stdlib.h>
C. #include <iostream>
D. #include<conio.h>
Answer: C
QUESTION: 14
What is the output of the program?
#include <iostream>
using namespace std;
int main()
{
int tab[4]={10,20,30,40};
tab[1]=10;
int *p;
p=&tab[0];
cout<<*p;
CPA
9 http://www.troytec.com
return 0;
}
A. It prints: 10
B. It prints: 20
C. It prints: 11
D. It prints: 30
Answer: A
QUESTION: 15
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int fun(int x) {
return 2*x;
}
int main(){
int i;
i = fun(1) & fun(0);
cout << i;
return 0;
}
A. It prints: 0
B. It prints: 1
C. It prints: -1
D. Compilation error
Answer: A
QUESTION: 16
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
virtual void Print()=0;
};
class B:public A {
CPA
10 http://www.troytec.com
public:
virtual void Print() { cout<< "B"; }
};
class C:public A {
public:
virtual void Print() { cout<< "C"; }
};
int main()
{
B ob2;
C ob3;
A *obj;
obj = &ob2;
obj?>Print();
obj = &ob3;
obj?>Print();
}
A. It prints: BC
B. It prints: CB
C. It prints: CC
D. It prints: BB
Answer: A
QUESTION: 17
What will the variable "age" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
};
class B : private A {
string name;
public:
void Print() {
cout << name << age;
}
};
CPA
11 http://www.troytec.com
A. public
B. private
C. protected
D. None of these
Answer: B
QUESTION: 18
What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int x=5;
static int y;
int i=0;
void static myFunction()
{
y=x++ + ++i;
}
int main (int argc, const char * argv[])
{
x++;
myFunction();
cout<<y<<" "<<x<< " " << i;
}
A. Compilation fails
B. It prints: 5 5 0
C. It prints: 7 7 1
D. It prints: 6 5 1
Answer: C
QUESTION: 19
Which of the structures is incorrect?
1:
struct s1{
int x;
long int li;
};
2:
struct s2{
CPA
12 http://www.troytec.com
float f;
struct s2 *s;
};
3:
struct s3{
float f;
struct s3 s;
};
A. 1
B. 2
C. 3
D. 2, 3
Answer: C
QUESTION: 20
What is the output of the program?
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1="Wo";
string s2;
s2 = s1;
string s3;
s3 = s2.append("rldHello");
cout << s3;
return( 0 );
}
A. It prints: WorldHello
B. It prints: HelloWo
C. It prints: World
D. It prints: Hello
Answer: A
CPA
13 http://www.troytec.com

More Related Content

What's hot

C++17 not your father’s c++
C++17  not your father’s c++C++17  not your father’s c++
C++17 not your father’s c++Patrick Viafore
 
Data structures and algorithms unit i
Data structures and algorithms unit iData structures and algorithms unit i
Data structures and algorithms unit isonalisraisoni
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011Deepak Singh
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU
 
Source code of WPF samples by Microsoft was checked
Source code of WPF samples by Microsoft was checkedSource code of WPF samples by Microsoft was checked
Source code of WPF samples by Microsoft was checkedPVS-Studio
 
Puzles C#
Puzles C#Puzles C#
Puzles C#lantoli
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsMuhammadTalha436
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)Olve Maudal
 
C __paper.docx_final
C __paper.docx_finalC __paper.docx_final
C __paper.docx_finalSumit Sar
 
programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ reportvikram mahendra
 
(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2Pamidimukkala Sivani
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)Poonam Chopra
 
C s investigatory project on telephone directory
C s  investigatory project on telephone directoryC s  investigatory project on telephone directory
C s investigatory project on telephone directorySHUBHAM YADAV
 
C++ Concepts and Ranges - How to use them?
C++ Concepts and Ranges - How to use them?C++ Concepts and Ranges - How to use them?
C++ Concepts and Ranges - How to use them?Mateusz Pusz
 

What's hot (20)

C++17 not your father’s c++
C++17  not your father’s c++C++17  not your father’s c++
C++17 not your father’s c++
 
Data structures and algorithms unit i
Data structures and algorithms unit iData structures and algorithms unit i
Data structures and algorithms unit i
 
CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011CBSE Question Paper Computer Science with C++ 2011
CBSE Question Paper Computer Science with C++ 2011
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применение
 
Source code of WPF samples by Microsoft was checked
Source code of WPF samples by Microsoft was checkedSource code of WPF samples by Microsoft was checked
Source code of WPF samples by Microsoft was checked
 
Puzles C#
Puzles C#Puzles C#
Puzles C#
 
Solved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ ExamsSolved Practice Problems For the C++ Exams
Solved Practice Problems For the C++ Exams
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
 
Technical questions
Technical questionsTechnical questions
Technical questions
 
C __paper.docx_final
C __paper.docx_finalC __paper.docx_final
C __paper.docx_final
 
programming in C++ report
programming in C++ reportprogramming in C++ report
programming in C++ report
 
Part - 3 Cpp programming Solved MCQ
Part - 3 Cpp programming Solved MCQ  Part - 3 Cpp programming Solved MCQ
Part - 3 Cpp programming Solved MCQ
 
(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2(Www.entrance exam.net)-tcs placement sample paper 2
(Www.entrance exam.net)-tcs placement sample paper 2
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)Sample Paper 2 Class XI (Computer Science)
Sample Paper 2 Class XI (Computer Science)
 
C s investigatory project on telephone directory
C s  investigatory project on telephone directoryC s  investigatory project on telephone directory
C s investigatory project on telephone directory
 
C++ Concepts and Ranges - How to use them?
C++ Concepts and Ranges - How to use them?C++ Concepts and Ranges - How to use them?
C++ Concepts and Ranges - How to use them?
 
Programs of C++
Programs of C++Programs of C++
Programs of C++
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
 
3XRC4
3XRC43XRC4
3XRC4
 

Similar to C++ Certified Associate Programmer CPA

C# console applications.docx
C# console applications.docxC# console applications.docx
C# console applications.docxMehwishKanwal14
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomeshpraveensomesh
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 FeaturesJan Rüegg
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2Knowledge Center Computer
 
C language questions_answers_explanation
C language questions_answers_explanationC language questions_answers_explanation
C language questions_answers_explanationsrinath v
 
1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professionalIsabella789
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbTUSHARGAURAV11
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbTUSHARGAURAV11
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Udayan Khattry
 

Similar to C++ Certified Associate Programmer CPA (20)

C# console applications.docx
C# console applications.docxC# console applications.docx
C# console applications.docx
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
Scjp6.0
Scjp6.0Scjp6.0
Scjp6.0
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
C test
C testC test
C test
 
Hems
HemsHems
Hems
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 Features
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
 
1 c introduction
1 c introduction1 c introduction
1 c introduction
 
Oops Quiz
Oops QuizOops Quiz
Oops Quiz
 
C language questions_answers_explanation
C language questions_answers_explanationC language questions_answers_explanation
C language questions_answers_explanation
 
C exam
C examC exam
C exam
 
1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
 
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjbpointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
pointer.ppt hfkogfhkigfvjjgdsyhhgfdfghjb
 
Part - 2 Cpp programming Solved MCQ
Part - 2  Cpp programming Solved MCQ Part - 2  Cpp programming Solved MCQ
Part - 2 Cpp programming Solved MCQ
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
 
Aptitute question papers in c
Aptitute question papers in cAptitute question papers in c
Aptitute question papers in c
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 

More from Isabella789

T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...Isabella789
 
T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...Isabella789
 
1Z0-400 Exam-Oracle Communications Session Border Controller
1Z0-400 Exam-Oracle Communications Session Border Controller1Z0-400 Exam-Oracle Communications Session Border Controller
1Z0-400 Exam-Oracle Communications Session Border ControllerIsabella789
 
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...Isabella789
 
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR)
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR) HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR)
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR) Isabella789
 
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals 210-250 Exam-Understanding Cisco Cybersecurity Fundamentals
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals Isabella789
 
70 334 exam-core solutions of microsoft skype for business (beta)
70 334 exam-core solutions of microsoft skype for business (beta)70 334 exam-core solutions of microsoft skype for business (beta)
70 334 exam-core solutions of microsoft skype for business (beta)Isabella789
 
400-351 Exam-CCIE Wireless
400-351 Exam-CCIE Wireless  400-351 Exam-CCIE Wireless
400-351 Exam-CCIE Wireless Isabella789
 
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administrationIsabella789
 
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocpIsabella789
 
70-414 exam-implementing an advanced server infrastructure
70-414 exam-implementing an advanced server infrastructure70-414 exam-implementing an advanced server infrastructure
70-414 exam-implementing an advanced server infrastructureIsabella789
 
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software ReleaseIsabella789
 
210 250 exam-understanding cisco cybersecurity fundamentals
210 250 exam-understanding cisco cybersecurity fundamentals210 250 exam-understanding cisco cybersecurity fundamentals
210 250 exam-understanding cisco cybersecurity fundamentalsIsabella789
 
1z0-204 Exam-Oracle EBS R12: E-Business Essentials
1z0-204 Exam-Oracle EBS R12: E-Business Essentials 1z0-204 Exam-Oracle EBS R12: E-Business Essentials
1z0-204 Exam-Oracle EBS R12: E-Business Essentials Isabella789
 
1z0 061 exam-oracle database 12c sql fundamentals
1z0 061 exam-oracle database 12c sql fundamentals1z0 061 exam-oracle database 12c sql fundamentals
1z0 061 exam-oracle database 12c sql fundamentalsIsabella789
 
1y0 230 exam-citrix netscaler 12 essentials
1y0 230 exam-citrix netscaler 12 essentials1y0 230 exam-citrix netscaler 12 essentials
1y0 230 exam-citrix netscaler 12 essentialsIsabella789
 
Pmi acp exa- pmi agile certified practitioner
Pmi acp exa- pmi agile certified practitionerPmi acp exa- pmi agile certified practitioner
Pmi acp exa- pmi agile certified practitionerIsabella789
 
200-355 Exam-Implementing Cisco Wireless Network Fundamentals
200-355 Exam-Implementing Cisco Wireless Network Fundamentals 200-355 Exam-Implementing Cisco Wireless Network Fundamentals
200-355 Exam-Implementing Cisco Wireless Network Fundamentals Isabella789
 
Jn0 420 exam-jncis-dev ops
Jn0 420 exam-jncis-dev opsJn0 420 exam-jncis-dev ops
Jn0 420 exam-jncis-dev opsIsabella789
 
200 310-q&amp;a-demo-troytec
200 310-q&amp;a-demo-troytec200 310-q&amp;a-demo-troytec
200 310-q&amp;a-demo-troytecIsabella789
 

More from Isabella789 (20)

T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...
 
T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...T7 Exam-International Financial Reporting Standards for Compensation Professi...
T7 Exam-International Financial Reporting Standards for Compensation Professi...
 
1Z0-400 Exam-Oracle Communications Session Border Controller
1Z0-400 Exam-Oracle Communications Session Border Controller1Z0-400 Exam-Oracle Communications Session Border Controller
1Z0-400 Exam-Oracle Communications Session Border Controller
 
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...
2V0-622 Exam-VMware Certified Professional 6.5 – Data Center Virtualization (...
 
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR)
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR) HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR)
HP2-B129 Exam-HP Document Solutions Technical Fundamentals (LAR)
 
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals 210-250 Exam-Understanding Cisco Cybersecurity Fundamentals
210-250 Exam-Understanding Cisco Cybersecurity Fundamentals
 
70 334 exam-core solutions of microsoft skype for business (beta)
70 334 exam-core solutions of microsoft skype for business (beta)70 334 exam-core solutions of microsoft skype for business (beta)
70 334 exam-core solutions of microsoft skype for business (beta)
 
400-351 Exam-CCIE Wireless
400-351 Exam-CCIE Wireless  400-351 Exam-CCIE Wireless
400-351 Exam-CCIE Wireless
 
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration
1 y0 311 exam-citrix xenapp and xendesktop 7.15 ltsr advanced administration
 
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp
1z0 034 exam-upgrade oracle9i10g oca to oracle database 11g ocp
 
70-414 exam-implementing an advanced server infrastructure
70-414 exam-implementing an advanced server infrastructure70-414 exam-implementing an advanced server infrastructure
70-414 exam-implementing an advanced server infrastructure
 
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release
1Z0-027 Exam-Oracle Exadata Database Machine Administration, Software Release
 
210 250 exam-understanding cisco cybersecurity fundamentals
210 250 exam-understanding cisco cybersecurity fundamentals210 250 exam-understanding cisco cybersecurity fundamentals
210 250 exam-understanding cisco cybersecurity fundamentals
 
1z0-204 Exam-Oracle EBS R12: E-Business Essentials
1z0-204 Exam-Oracle EBS R12: E-Business Essentials 1z0-204 Exam-Oracle EBS R12: E-Business Essentials
1z0-204 Exam-Oracle EBS R12: E-Business Essentials
 
1z0 061 exam-oracle database 12c sql fundamentals
1z0 061 exam-oracle database 12c sql fundamentals1z0 061 exam-oracle database 12c sql fundamentals
1z0 061 exam-oracle database 12c sql fundamentals
 
1y0 230 exam-citrix netscaler 12 essentials
1y0 230 exam-citrix netscaler 12 essentials1y0 230 exam-citrix netscaler 12 essentials
1y0 230 exam-citrix netscaler 12 essentials
 
Pmi acp exa- pmi agile certified practitioner
Pmi acp exa- pmi agile certified practitionerPmi acp exa- pmi agile certified practitioner
Pmi acp exa- pmi agile certified practitioner
 
200-355 Exam-Implementing Cisco Wireless Network Fundamentals
200-355 Exam-Implementing Cisco Wireless Network Fundamentals 200-355 Exam-Implementing Cisco Wireless Network Fundamentals
200-355 Exam-Implementing Cisco Wireless Network Fundamentals
 
Jn0 420 exam-jncis-dev ops
Jn0 420 exam-jncis-dev opsJn0 420 exam-jncis-dev ops
Jn0 420 exam-jncis-dev ops
 
200 310-q&amp;a-demo-troytec
200 310-q&amp;a-demo-troytec200 310-q&amp;a-demo-troytec
200 310-q&amp;a-demo-troytec
 

Recently uploaded

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

C++ Certified Associate Programmer CPA

  • 1. Demo Edition © 2012 - 2013 Test Killer, LTD All Rights Reserved C++ Certified Associate Programmer Exam: CPA CPA 1 http://www.troytec.com
  • 2. QUESTION: 1 What will the variable "age" be in class B? class A { int x; protected: int y; public: int age; A () { age=5; }; }; class B : public A { string name; public: B () { name="Bob"; }; void Print() { cout << name << age; } }; A. public B. private C. protected D. None of these Answer: A QUESTION: 2 What happens when you attempt to compile and run the following code? #include <iostream> #include <string> using namespace std; class complex{ double re, im; public: complex() : re(1),im(0.4) {} complex operator?(complex &t); void Print() { cout << re << " " << im; } }; complex complex::operator? (complex &t){ complex temp; temp.re = this?>re ? t.re; temp.im = this?>im ? t.im; return temp; CPA 2 http://www.troytec.com
  • 3. } int main(){ complex c1,c2,c3; c3 = c1 ? c2; c3.Print(); } A. It prints: 1 0.4 B. It prints: 2 0.8 C. It prints: 0 0 D. It prints: 1 0.8 Answer: C QUESTION: 3 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class complex{ double re; double im; public: complex() : re(0),im(0) {} complex(double x) { re=x,im=x;}; complex(double x,double y) { re=x,im=y;} void print() { cout << re << " " << im;} }; int main(){ complex c1; c1 = 3.0; c1.print(); return 0; } A. It prints: 0 0 B. It prints: 1 1 C. It prints: 3 3 D. Compilation error Answer: C CPA 3 http://www.troytec.com
  • 4. QUESTION: 4 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; void fun(int); int main() { int a=0; fun(a); return 0; } void fun(int n) { if(n < 2) { fun(++n); cout << n; } } A. It prints: 21 B. It prints: 012 C. It prints: 0 D. None of these Answer: A QUESTION: 5 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int s(int n); int main() { int a; a = 3; cout << s(a); return 0; } int s(int n) { if(n == 0) return 1; CPA 4 http://www.troytec.com
  • 5. return s(n?1)*n; } A. It prints: 4 B. It prints: 6 C. It prints: 3 D. It prints: 0 Answer: B QUESTION: 6 What will be the output of the program? #include <iostream> using namespace std; int fun(int); int main() { cout << fun(5); return 0; } int fun(int i) { return i*i; } A. 25 B. 5 C. 0 D. 1 Answer: A QUESTION: 7 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; #define FUN(arg) if(arg) cout<<"Test"; int main() { int i=1; CPA 5 http://www.troytec.com
  • 6. FUN(i<3); return 0; } A. It prints: 0 B. It prints: T C. It prints: T0 D. It prints: Test Answer: D QUESTION: 8 What will the variable "y" be in class B? class A { int x; protected: int y; public: int age; }; class B : private A { string name; public: void Print() { cout << name << age; } }; A. public B. private C. protected D. None of these Answer: B QUESTION: 9 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() CPA 6 http://www.troytec.com
  • 7. { float x=3.5,y=1.6; int i,j=2; i = x + j + y; cout << i; return 0; } A. It prints: 7 B. It prints: 6 C. It prints: 7,1 D. Compilation error Answer: A QUESTION: 10 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main(){ int i = 1; if (i==1) { cout << i; } else { cout << i-1; } return 0; } A. It prints: 0 B. It prints: 1 C. It prints: -1 D. It prints: 2 Answer: B QUESTION: 11 What happens when you attempt to compile and run the following code? #include <iostream> #include <string> CPA 7 http://www.troytec.com
  • 8. using namespace std; class complex{ double re, im; public: complex() : re(1),im(0.4) {} complex operator+(complex &t); void Print() { cout << re << " " << im; } }; complex complex::operator+ (complex &t){ complex temp; temp.re = this?>re + t.re; temp.im = this?>im + t.im; return temp; } int main(){ complex c1,c2,c3; c3 = c1 + c2; c3.Print(); } A. It prints: 1 0.4 B. It prints: 2 0.8 C. It prints: 0 0 D. Garbage value Answer: B QUESTION: 12 What happens when you attempt to compile and run the following code? #include <cstdlib> #include <iostream> using namespace std; float* sum(float a,float b); float* sum(float a,float b) { float *f = new float; *f = a+b; return f; } int main() { float a,b,*f; a = 1.5; b = 3.4; CPA 8 http://www.troytec.com
  • 9. f = sum(a,b); cout<<*f; return 0; } A. It prints: 0 B. It prints: 4.9 C. It prints: 5 D. It prints: 4 Answer: B QUESTION: 13 Which statement should be added in the following program to make work it correctly? using namespace std; int main (int argc, const char * argv[]) { cout<<"Hello"; } A. #include<stdio.h> B. #include<stdlib.h> C. #include <iostream> D. #include<conio.h> Answer: C QUESTION: 14 What is the output of the program? #include <iostream> using namespace std; int main() { int tab[4]={10,20,30,40}; tab[1]=10; int *p; p=&tab[0]; cout<<*p; CPA 9 http://www.troytec.com
  • 10. return 0; } A. It prints: 10 B. It prints: 20 C. It prints: 11 D. It prints: 30 Answer: A QUESTION: 15 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int fun(int x) { return 2*x; } int main(){ int i; i = fun(1) & fun(0); cout << i; return 0; } A. It prints: 0 B. It prints: 1 C. It prints: -1 D. Compilation error Answer: A QUESTION: 16 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class A { public: virtual void Print()=0; }; class B:public A { CPA 10 http://www.troytec.com
  • 11. public: virtual void Print() { cout<< "B"; } }; class C:public A { public: virtual void Print() { cout<< "C"; } }; int main() { B ob2; C ob3; A *obj; obj = &ob2; obj?>Print(); obj = &ob3; obj?>Print(); } A. It prints: BC B. It prints: CB C. It prints: CC D. It prints: BB Answer: A QUESTION: 17 What will the variable "age" be in class B? class A { int x; protected: int y; public: int age; }; class B : private A { string name; public: void Print() { cout << name << age; } }; CPA 11 http://www.troytec.com
  • 12. A. public B. private C. protected D. None of these Answer: B QUESTION: 18 What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int x=5; static int y; int i=0; void static myFunction() { y=x++ + ++i; } int main (int argc, const char * argv[]) { x++; myFunction(); cout<<y<<" "<<x<< " " << i; } A. Compilation fails B. It prints: 5 5 0 C. It prints: 7 7 1 D. It prints: 6 5 1 Answer: C QUESTION: 19 Which of the structures is incorrect? 1: struct s1{ int x; long int li; }; 2: struct s2{ CPA 12 http://www.troytec.com
  • 13. float f; struct s2 *s; }; 3: struct s3{ float f; struct s3 s; }; A. 1 B. 2 C. 3 D. 2, 3 Answer: C QUESTION: 20 What is the output of the program? #include <iostream> #include <string> using namespace std; int main() { string s1="Wo"; string s2; s2 = s1; string s3; s3 = s2.append("rldHello"); cout << s3; return( 0 ); } A. It prints: WorldHello B. It prints: HelloWo C. It prints: World D. It prints: Hello Answer: A CPA 13 http://www.troytec.com