CSC102 Final Exam |Questions with 100%
Correct Answers
What is the syntax of template and what does each parameter stand for? - ✔️✔️template <class
Type> declaration;
class- any user defined or built-in type
type- data type; formal parameter to the template
When does passing a parameter to a function take effect? - ✔️✔️at run time
When does passing a parameter to a class template take effect? - ✔️✔️at compile time
The implementation file cannot be compiled independently of the client code. - ✔️✔️True
The user can put class and function definition templates directly in the client code. - ✔️✔️True
The user can put class and function definition templates in the same header file. - ✔️✔️True
You can put class definitions and functions definitions in separate files. - ✔️✔️True
Function definitions and client codes are compiled together. - ✔️✔️True
An operator that has different meanings with different data types is said to be _____________.
- ✔️✔️Overloaded
Operator functions are ______-returning. - ✔️✔️Value
,Operator overloading provides the same concise notation for user-defined data types as for
built-in data types. - ✔️✔️True
Only existing operators can be overloaded. - ✔️✔️True
If an operator function is a member of a class, the leftmost operand must be a ________ object
of that operator's class. - ✔️✔️class
What is a parameterized type? - ✔️✔️a class template
What is an exception? - ✔️✔️An undesirable event in program execution
An exception-handling code can be added at a point where an error may occur. - ✔️✔️True
What does the assertion function do? - ✔️✔️Checks if an expressions meets certain conditions
and terminates if they are not met.
What is a try/catch block used for? - ✔️✔️To handle exceptions
Exception must be _____ in a try block and ______ by a catch block. - ✔️✔️thrown;caught
Statements that may generate an exception are placed in a _______ block. - ✔️✔️try
try block is followed by one or more catch blocks - ✔️✔️true
If the heading of a catch block contains (...) in place of parameters, that mean it can
catch_________. - ✔️✔️exceptions of all types
, If no exception is thrown in a try block, _________________. - ✔️✔️All catch blocks are ignored
and execution resumes after the last catch block.
If an exception is thrown in a try block, remaining statements are ____________. - ✔️✔️ignored
If the type of thrown exception matches the parameter type in one of the catch blocks, the
code of that block __________ and the remaining blocks are _________. - ✔️✔️executes;
ignored
A catch block can have at most _____ catch block parameter and becomes a placeholder for the
thrown value. - ✔️✔️one
For a try/catch block to work, the exception must be thrown in the ________. - ✔️✔️try block
Object being throw can only be a specific object. - ✔️✔️False; it can also be an anonymous
object.
An exception is a value. - ✔️✔️True
What can a catch block catch? - ✔️✔️All exceptions of a specific type and and all types of
exceptions
What does the WHAT function do? - ✔️✔️Returns a string containing the exception object
thrown by exception classes; tells you in words which exception object was thrown
What is a class exception? And what header file is it contained in? - ✔️✔️base class of the
exception classes;
exception
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 Examcheatcode. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.