SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
GSP 125 Final Exam Guide
Purchase This Material Click below Link
FOR MORE CLASSES VISIT
www.gsp125rank.com
Question 1. 1. In addition to grouping functions together, a class also groups (Points :
3)
libraries.
math operations.
print statements.
variables.
Question 2. 2. Hiding data in a class is also called (Points : 3)
encapsulation.
accessibility inversion.
confusion culling.
redirection.
Question 3. 3. The public members of a class (Points : 3)
can be changed after compiling, even functions.
must be accessed from an object of that class.
need a special interface to accessed from an object.
can only be accessed within member functions of that class.
Question 4. 4. Constructors are called (Points : 3)
whenever an object is created.
whenever a new line of code is typed.
only after math operations.
only after a work contract is defined.
Question 5. 5. Unions are (Points : 3)
defined just like structs, though their memory behaves differently.
a place to store multiple data types simultaneously.
a concept from the C language that is uncommon in C++.
All of the above
Question 6. 6. When objects contain other objects, it is called (Points : 3)
composition.
data blending.
subobjecting.
enclosures.
Question 7. 7. Using the sizeof operator, the compiler will provide the size in bytes of
a (Points : 3)
class or data type.
statically allocated array.
variable instance or object.
All of the above
Question 8. 8. When de-allocating arrays dynamically allocated with new, _____
should be used to ensure proper de-allocation. (Points : 3)
destructor.
delete.
delete [].
free().
Question 9. 9. A pointer stores a(n) (Points : 3)
address.
variable.
value.
None of the above
Question 10. 10. The most common operator used when accessing members of an
object through a pointer is this. (Points : 3)
&
->
.
::
Question 11. 11. The following can be used to determine the number of elements in a
statically allocated array in C or C++. (Points : 3)
sizeof(arrayname)/sizeof(arrayname[0])
elementsof<arrayname>
arrayname.length()
None of the above
Question 12. 12. When returning by reference, (Points : 3)
the method can be used as an l-value.
other functions cannot use the result as a parameter.
C-style code must be capitalized, as per standard convention.
There is no such thing as returning by reference.
Question 13. 13. Overloaded methods in a class must use (Points : 3)
the exact same argument types, but different return types.
the exact same name.
default arguments.
None of the above
Question 14. 14. The copy constructor takes (Points : 3)
no arguments.
a single argument by reference.
a single argument by value.
any number of arguments.
Question 15. 15. A shallow copy is dangerous because (Points : 3)
it has a knife and is very clumsy.
it may cause bad de-allocation in a properly written destructor in a class that
allocates memory.
it prevents recursive methods from being called by using significant amounts of
stack space.
None of the above
Question 16. 16. When using inheritance, the class that is doing the inheriting is called
a (Points : 3)
subclass.
child class.
derived class.
All of the above
Question 17. 17. A UML class diagram is commonly used to (Points : 3)
exactly describe code before writing it.
help programmers explain design to other programmers.
define code standards (for syntax) for programming teams.
All of the above
Question 18. 18. Downcasting is considered safe because (Points : 3)
the compiler is very smart about types.
it is safe to assume a parent can do everything a child can do.
downcasting can only be done on upcasted objects.
downcasting is not considered safe.
Question 19. 19. If unsure whether to use inheritance or composition, use (Points : 3)
inheritance, because it saves the most typing.
inheritance, because C++ supports multiple inheritance.
composition, because it gives programmers the most options.
composition, because it is more efficient than inheritance.
Question 20. 20. Creating classes in separate .h and .cpp files is good because (Points :
3)
moving code to separate files is good design (separation of concerns).
separating declaration from definition allows decoupling of dependencies.
many smaller files are easier to maintain by teams of programmers.
All of the above
Question 21. 21. When using the virtual keyword, C++ can detect the type of an
object by using (Points : 3)
Compile Time Type Information.
dynamic_cast.
a "constructor inference" pattern.
C++ does not support any kind of reflection.
Question 22. 22. Passing pointers by reference (e.g., "(int * & arg)") is possible but
limited, because (Points : 3)
NULL cannot be passed as a valid pointer by reference.
a raw address (&variable) cannot be passed as a valid pointer by reference.
r-values cannot be passed as pointers by reference.
All of the above
Question 23. 23. Stack memory is where (Points : 3)
global variables and raw machine code are stored.
local variables and execution of instructions are kept track of.
dynamic memory is allocated to.
None of the above
Question 24. 24. A compiler will put sentinel values into memory to (Points : 3)
help detect array out-of-bound errors.
keep track of how many times a function recurses.
stop bad functions from being executed.
prevent memory leaks.
Question 25. 25. Virtual functions have a cost when compared to normal (statically
bound) functions; specifically, they are (Points : 3)
slower and less optimizable.
less dynamic.
unusable with polymorphism.
more difficult to read than extern or static functions.
Question 26. 26. In C++, the diamond problem that results from multiple inheritance
can be solved by (Points : 3)
extern inheritance.
static inheritance.
virtual inheritance.
inline inheritance.
Question 27. 27. Test-driven development is (Points : 3)
writing software after finishing multiple choice exams about software quality.
writing many small tests that initially fail, and working on each test until all
succeed.
another name for object-oriented programming.
All of the above
Question 28. 28. Which piece of the C/C++ compile tool chain arranges compiled
code into the final executable? (Points : 3)
Preprocessor
Compiler
Linker
Debugger
Question 29. 29. For C-style error codes to be used effectively, a programmer should
(Points : 3)
always do logic on function returns to test success.
check errno after potentially failed operations to see if any errors occurred.
read documentation to make sense of error codes.
All of the above
Question 30. 30. A class template allows (Points : 3)
a class to be re-defined with different types but the same code.
the compiler to ignore unused methods of the templated class.
the templated type to be any type, including another templated type.
All of the above
Question 31. 31. Write a “Hello World” program in C++. (Points : 2)
Question 32. 32. Write code for a struct called “Coin.” The Coin class should have a
floating-point member for radius and thickness and weight, a c-string member for
name, and an integer member for color. (Points : 7)
Question 33. 33. Write code for a class called "Double." The Double class should
have a single double member, value. Create accessors and mutators for value. The
default constructor of Double should set value to zero. (Points : 7)
Question 34. 34. Write a class named Person and create another class called Teacher,
which inherits from Person (Person is the parent class and Teacher is the child class).
(Points : 7)
Question 35. 35. Write code that instantiates an integer and prints out its address.
(Points : 7)
Question 36. 36. Write the body of thfollowing function so that it returns the square of
the number pointed at by the pointer argument.
float square(float * valuePtr)
{
} (Points : 7)
Question 37. 37. Consider the following class.
class ManagedArray {
public:
float * data;
int size;
ManagedArray():data(0),size(0){}
void setSize(int a_size){ size = a_size; data = new float[size]; }
};
Write a destructor for this class to de-allocate any memory it may have allocated.
(Points : 7)
Question 38. 38. Write code that dynamically allocates a two-dimensional array of
integers called map, 5 high, and 7 wide. Then, de-allocate the two-dimensional array.
(Points : 7)
Question 39. 39. Write code that allocates an integer on the stack and allocates another
integer array on the heap. (Points : 7)
Question 40.
40. Write an abstract base class called LivingThing that has the following methods:
breathe and eat. (Points : 7)

Más contenido relacionado

La actualidad más candente

Gsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.comGsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.comStephenson101
 
GSP 125 RANK Education for Service--gsp125rank.com
GSP 125 RANK  Education for Service--gsp125rank.comGSP 125 RANK  Education for Service--gsp125rank.com
GSP 125 RANK Education for Service--gsp125rank.comclaric25
 
Gsp 125 Future Our Mission/newtonhelp.com
Gsp 125 Future Our Mission/newtonhelp.comGsp 125 Future Our Mission/newtonhelp.com
Gsp 125 Future Our Mission/newtonhelp.comamaranthbeg8
 
Uop gsp 125 final exam guide new
Uop gsp 125 final exam guide newUop gsp 125 final exam guide new
Uop gsp 125 final exam guide newElijahEthaan
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEWshyamuopten
 
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12chinthala Vijaya Kumar
 
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...chinthala Vijaya Kumar
 
Sample Question Paper IP Class xii
Sample Question Paper IP Class xii Sample Question Paper IP Class xii
Sample Question Paper IP Class xii kvs
 

La actualidad más candente (16)

Gsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.comGsp 125 Enthusiastic Study / snaptutorial.com
Gsp 125 Enthusiastic Study / snaptutorial.com
 
GSP 125 RANK Education for Service--gsp125rank.com
GSP 125 RANK  Education for Service--gsp125rank.comGSP 125 RANK  Education for Service--gsp125rank.com
GSP 125 RANK Education for Service--gsp125rank.com
 
Gsp 125 Future Our Mission/newtonhelp.com
Gsp 125 Future Our Mission/newtonhelp.comGsp 125 Future Our Mission/newtonhelp.com
Gsp 125 Future Our Mission/newtonhelp.com
 
Uop gsp 125 final exam guide new
Uop gsp 125 final exam guide newUop gsp 125 final exam guide new
Uop gsp 125 final exam guide new
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
 
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
 
Java execise
Java execiseJava execise
Java execise
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Intake 37 ef2
Intake 37 ef2Intake 37 ef2
Intake 37 ef2
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
 
Intake 38 4
Intake 38 4Intake 38 4
Intake 38 4
 
Intake 38_1
Intake 38_1Intake 38_1
Intake 38_1
 
Lesson 4 stacks and queues
Lesson 4  stacks and queuesLesson 4  stacks and queues
Lesson 4 stacks and queues
 
Sample Question Paper IP Class xii
Sample Question Paper IP Class xii Sample Question Paper IP Class xii
Sample Question Paper IP Class xii
 

Similar a GSP 125 Final Exam Guide

GSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.comGSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.comsholingarjosh136
 
Gsp 125 Massive Success / snaptutorial.com
Gsp 125  Massive Success / snaptutorial.comGsp 125  Massive Success / snaptutorial.com
Gsp 125 Massive Success / snaptutorial.comNorrisMistryzo
 
GSP 125 Perfect Education/newtonhelp.com
GSP 125 Perfect Education/newtonhelp.comGSP 125 Perfect Education/newtonhelp.com
GSP 125 Perfect Education/newtonhelp.combellflower169
 
GSP 125 Become Exceptional/newtonhelp.com
GSP 125 Become Exceptional/newtonhelp.comGSP 125 Become Exceptional/newtonhelp.com
GSP 125 Become Exceptional/newtonhelp.combellflower148
 
GSP 125 Doing by learn/newtonhelp.com
GSP 125 Doing by learn/newtonhelp.comGSP 125 Doing by learn/newtonhelp.com
GSP 125 Doing by learn/newtonhelp.combellflower126
 
Exercise1[5points]Create the following classe
Exercise1[5points]Create the following classeExercise1[5points]Create the following classe
Exercise1[5points]Create the following classemecklenburgstrelitzh
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programmingsoni_nits
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSnikshaikh786
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guidekrtioplal
 
C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)Umar Farooq
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docxrosemarybdodson23141
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxmaxinesmith73660
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#ANURAG SINGH
 

Similar a GSP 125 Final Exam Guide (20)

GSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.comGSP 125 Technology levels--snaptutorial.com
GSP 125 Technology levels--snaptutorial.com
 
Gsp 125 Massive Success / snaptutorial.com
Gsp 125  Massive Success / snaptutorial.comGsp 125  Massive Success / snaptutorial.com
Gsp 125 Massive Success / snaptutorial.com
 
GSP 125 Perfect Education/newtonhelp.com
GSP 125 Perfect Education/newtonhelp.comGSP 125 Perfect Education/newtonhelp.com
GSP 125 Perfect Education/newtonhelp.com
 
GSP 125 Become Exceptional/newtonhelp.com
GSP 125 Become Exceptional/newtonhelp.comGSP 125 Become Exceptional/newtonhelp.com
GSP 125 Become Exceptional/newtonhelp.com
 
GSP 125 Doing by learn/newtonhelp.com
GSP 125 Doing by learn/newtonhelp.comGSP 125 Doing by learn/newtonhelp.com
GSP 125 Doing by learn/newtonhelp.com
 
Exercise1[5points]Create the following classe
Exercise1[5points]Create the following classeExercise1[5points]Create the following classe
Exercise1[5points]Create the following classe
 
17432 object oriented programming
17432   object oriented programming17432   object oriented programming
17432 object oriented programming
 
SE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUSSE-IT JAVA LAB SYLLABUS
SE-IT JAVA LAB SYLLABUS
 
Comp 328 final guide
Comp 328 final guideComp 328 final guide
Comp 328 final guide
 
Oop december 2018
Oop december 2018Oop december 2018
Oop december 2018
 
C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)C# (This keyword, Properties, Inheritance, Base Keyword)
C# (This keyword, Properties, Inheritance, Base Keyword)
 
Vectors Intro.ppt
Vectors Intro.pptVectors Intro.ppt
Vectors Intro.ppt
 
Name _______________________________ Class time __________.docx
Name _______________________________    Class time __________.docxName _______________________________    Class time __________.docx
Name _______________________________ Class time __________.docx
 
E1
E1E1
E1
 
Oop july 2017
Oop july 2017Oop july 2017
Oop july 2017
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#
 
Ch03
Ch03Ch03
Ch03
 
Ch03
Ch03Ch03
Ch03
 
1
11
1
 

Último

How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptxAneriPatwari
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 

Último (20)

Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptx
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 

GSP 125 Final Exam Guide

  • 1. GSP 125 Final Exam Guide Purchase This Material Click below Link FOR MORE CLASSES VISIT www.gsp125rank.com Question 1. 1. In addition to grouping functions together, a class also groups (Points : 3) libraries. math operations. print statements. variables. Question 2. 2. Hiding data in a class is also called (Points : 3) encapsulation. accessibility inversion. confusion culling. redirection. Question 3. 3. The public members of a class (Points : 3) can be changed after compiling, even functions. must be accessed from an object of that class. need a special interface to accessed from an object. can only be accessed within member functions of that class. Question 4. 4. Constructors are called (Points : 3) whenever an object is created.
  • 2. whenever a new line of code is typed. only after math operations. only after a work contract is defined. Question 5. 5. Unions are (Points : 3) defined just like structs, though their memory behaves differently. a place to store multiple data types simultaneously. a concept from the C language that is uncommon in C++. All of the above Question 6. 6. When objects contain other objects, it is called (Points : 3) composition. data blending. subobjecting. enclosures. Question 7. 7. Using the sizeof operator, the compiler will provide the size in bytes of a (Points : 3) class or data type. statically allocated array. variable instance or object. All of the above Question 8. 8. When de-allocating arrays dynamically allocated with new, _____ should be used to ensure proper de-allocation. (Points : 3) destructor.
  • 3. delete. delete []. free(). Question 9. 9. A pointer stores a(n) (Points : 3) address. variable. value. None of the above Question 10. 10. The most common operator used when accessing members of an object through a pointer is this. (Points : 3) & -> . :: Question 11. 11. The following can be used to determine the number of elements in a statically allocated array in C or C++. (Points : 3) sizeof(arrayname)/sizeof(arrayname[0]) elementsof<arrayname> arrayname.length() None of the above Question 12. 12. When returning by reference, (Points : 3) the method can be used as an l-value. other functions cannot use the result as a parameter.
  • 4. C-style code must be capitalized, as per standard convention. There is no such thing as returning by reference. Question 13. 13. Overloaded methods in a class must use (Points : 3) the exact same argument types, but different return types. the exact same name. default arguments. None of the above Question 14. 14. The copy constructor takes (Points : 3) no arguments. a single argument by reference. a single argument by value. any number of arguments. Question 15. 15. A shallow copy is dangerous because (Points : 3) it has a knife and is very clumsy. it may cause bad de-allocation in a properly written destructor in a class that allocates memory. it prevents recursive methods from being called by using significant amounts of stack space. None of the above Question 16. 16. When using inheritance, the class that is doing the inheriting is called a (Points : 3) subclass. child class. derived class.
  • 5. All of the above Question 17. 17. A UML class diagram is commonly used to (Points : 3) exactly describe code before writing it. help programmers explain design to other programmers. define code standards (for syntax) for programming teams. All of the above Question 18. 18. Downcasting is considered safe because (Points : 3) the compiler is very smart about types. it is safe to assume a parent can do everything a child can do. downcasting can only be done on upcasted objects. downcasting is not considered safe. Question 19. 19. If unsure whether to use inheritance or composition, use (Points : 3) inheritance, because it saves the most typing. inheritance, because C++ supports multiple inheritance. composition, because it gives programmers the most options. composition, because it is more efficient than inheritance. Question 20. 20. Creating classes in separate .h and .cpp files is good because (Points : 3) moving code to separate files is good design (separation of concerns). separating declaration from definition allows decoupling of dependencies. many smaller files are easier to maintain by teams of programmers. All of the above
  • 6. Question 21. 21. When using the virtual keyword, C++ can detect the type of an object by using (Points : 3) Compile Time Type Information. dynamic_cast. a "constructor inference" pattern. C++ does not support any kind of reflection. Question 22. 22. Passing pointers by reference (e.g., "(int * & arg)") is possible but limited, because (Points : 3) NULL cannot be passed as a valid pointer by reference. a raw address (&variable) cannot be passed as a valid pointer by reference. r-values cannot be passed as pointers by reference. All of the above Question 23. 23. Stack memory is where (Points : 3) global variables and raw machine code are stored. local variables and execution of instructions are kept track of. dynamic memory is allocated to. None of the above Question 24. 24. A compiler will put sentinel values into memory to (Points : 3) help detect array out-of-bound errors. keep track of how many times a function recurses. stop bad functions from being executed. prevent memory leaks. Question 25. 25. Virtual functions have a cost when compared to normal (statically bound) functions; specifically, they are (Points : 3) slower and less optimizable.
  • 7. less dynamic. unusable with polymorphism. more difficult to read than extern or static functions. Question 26. 26. In C++, the diamond problem that results from multiple inheritance can be solved by (Points : 3) extern inheritance. static inheritance. virtual inheritance. inline inheritance. Question 27. 27. Test-driven development is (Points : 3) writing software after finishing multiple choice exams about software quality. writing many small tests that initially fail, and working on each test until all succeed. another name for object-oriented programming. All of the above Question 28. 28. Which piece of the C/C++ compile tool chain arranges compiled code into the final executable? (Points : 3) Preprocessor Compiler Linker Debugger Question 29. 29. For C-style error codes to be used effectively, a programmer should (Points : 3) always do logic on function returns to test success. check errno after potentially failed operations to see if any errors occurred. read documentation to make sense of error codes. All of the above
  • 8. Question 30. 30. A class template allows (Points : 3) a class to be re-defined with different types but the same code. the compiler to ignore unused methods of the templated class. the templated type to be any type, including another templated type. All of the above Question 31. 31. Write a “Hello World” program in C++. (Points : 2) Question 32. 32. Write code for a struct called “Coin.” The Coin class should have a floating-point member for radius and thickness and weight, a c-string member for name, and an integer member for color. (Points : 7) Question 33. 33. Write code for a class called "Double." The Double class should have a single double member, value. Create accessors and mutators for value. The default constructor of Double should set value to zero. (Points : 7) Question 34. 34. Write a class named Person and create another class called Teacher, which inherits from Person (Person is the parent class and Teacher is the child class). (Points : 7) Question 35. 35. Write code that instantiates an integer and prints out its address. (Points : 7) Question 36. 36. Write the body of thfollowing function so that it returns the square of the number pointed at by the pointer argument. float square(float * valuePtr) { } (Points : 7) Question 37. 37. Consider the following class. class ManagedArray { public: float * data; int size; ManagedArray():data(0),size(0){} void setSize(int a_size){ size = a_size; data = new float[size]; }
  • 9. }; Write a destructor for this class to de-allocate any memory it may have allocated. (Points : 7) Question 38. 38. Write code that dynamically allocates a two-dimensional array of integers called map, 5 high, and 7 wide. Then, de-allocate the two-dimensional array. (Points : 7) Question 39. 39. Write code that allocates an integer on the stack and allocates another integer array on the heap. (Points : 7) Question 40. 40. Write an abstract base class called LivingThing that has the following methods: breathe and eat. (Points : 7)