1. Write the signature for the pure virtual function, Update. 2. What is a pure
ID: 3771640 • Letter: 1
Question
1.
Write the signature for the pure virtual function, Update.
2.
What is a pure virtual function missing that normal functions have?
3.
These statements should be used within functions and listed in an exception specification for the function.
4.
What is most likely to cause an exception?
5.
Exceptions can be thrown across scopes.
6.
Every keyword should have a corresponding keyword (think dynamic memory allocation)
7.
A derived class, D, can access the private members/methods of its base class, B
8.
An uncaught exception in C++ is ignored.
9.
Constructors are inherited. After all something has to initalize the inherited variables.
10.
In a "has-a" relationship, we know we are using
11.
In a(n) ______ relationship, an object of a derived class also can be treated as an object of its base class.
12.
Also known as specialization, is the means of taking a class and adding new, specific methods / members to it to serve a new, more focused purpose.
13.
What is polymorphism? How does it work? Be sure to use all associated terminology.
HTML Editor
14.
What is the difference between * and &? What do they do and when do you use them?
HTML Editor
15.
Where is the best place to put data validation in your class. What can be done to ensure good data and to avoid redundancy of code?
1.
Write the signature for the pure virtual function, Update.
2.
What is a pure virtual function missing that normal functions have?
3.
These statements should be used within functions and listed in an exception specification for the function.
A) sendB) throws
C) throw
D) pass
4.
What is most likely to cause an exception?
A) The syntax in your codeB) Accessing files on the hard drive
C) power failures
D) the user entering input
E) the logic of your code
5.
Exceptions can be thrown across scopes.
A) TrueB) False
6.
Every keyword should have a corresponding keyword (think dynamic memory allocation)
7.
A derived class, D, can access the private members/methods of its base class, B
A) TrueB) False
8.
An uncaught exception in C++ is ignored.
A) TrueB) False
9.
Constructors are inherited. After all something has to initalize the inherited variables.
A) TrueB) False
10.
In a "has-a" relationship, we know we are using
11.
In a(n) ______ relationship, an object of a derived class also can be treated as an object of its base class.
A) "is-a"B) "has-a"
C) transitive
D) intransitive
E) None of these
12.
Also known as specialization, is the means of taking a class and adding new, specific methods / members to it to serve a new, more focused purpose.
13.
What is polymorphism? How does it work? Be sure to use all associated terminology.
HTML Editor
14.
What is the difference between * and &? What do they do and when do you use them?
HTML Editor
15.
Where is the best place to put data validation in your class. What can be done to ensure good data and to avoid redundancy of code?
Explanation / Answer
1. pure virtual functions have no body (the function must be implemented in child classes)
2. normal function has body but pure virtual funtion do not
3. B) throws
4. A) The syntax in your code
5. B False
6. yes
7. False
8. true
9. false
10.
11. D) intransitive
12.
13. Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic.
14. A common character entity used in HTML is the non-breaking space ( ).
Remember that browsers will always truncate spaces in HTML pages. If you write 10 spaces in your text, the browser will remove 9 of them. To add real spaces to your text, you can use the character entity.
15. Data Validation Examples
A good example of a pattern for data validation to prevent OS injection in PHP applications would be as follows:
$string = preg_replace("/[^a-zA-Z0-9]/", "", $string);
This code above would replace any non alphanumeric characters with “”. preg_grep() could also be used for a True or False result. This would enable us to let “only known good” characters into the application.
Using regular expressions is a common method of restricting input character types. A common mistake in the development of regular expressions is not escaping characters, which are interpreted as control characters, or not validating all avenues of input.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.