Save Time & improve Grades
- Questions Asked
- Experts
- Total Answered
Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!
Computer Science homework help
1- A destructor, unlike any other normal function, (Points : 3)
has no return type and must begin with ~.
can be automatically called, without code showing it.
cannot have parameters.
All of the above
2. Variable data in a class is never called a(n) _____ by programmers. (Points : 3)
member variable
attribute
field
behavior
Question 3. 3. When accessing class members, the member operator is used. The member operator is the following punctuation. (Points : 3) <..>
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. Passing by reference and by pointer are very similar, except that (Points : 3)
NULL cannot be passed by reference.
when passing objects by reference, . is used; by pointer, -> is used.
variables passed by pointer must be dereferenced and passed using an address.
All of the above
Question 13. 13. Overloaded operators (Points : 3)
should always be used to replace functions with long names.
are encouraged to be used creatively by professional programmers.
are widely supported by most computer languages.
None of the above
Question 14. 14. Every object can use a copy constructor whether or not one is defined. The default copy constructor performs (Points : 3)
nothing; the default copy constructor must be overwritten to function correctly.
a shallow copy, which will only copy variable and pointer values and ignore allocated memory.
a deep copy, which will correctly duplicate allocated memory.
is rarely used by programmers because of how error prone it is, especially for very small (in bytes) types.
Question 15. 15. A constructor is called automatically whenever (Points : 3)
an argument is passed by value.
an object is created without parameters.
a function returns an object by value.
All of the above
Question 16. 16. A child class does not inherit _____ from a super class. (Points : 3)
constructors
access to private members
functions that have been overloaded
All of the above
Question 17. 17. When a parent class is typecast to a child, this is called (Points : 3)
evolution.
reheritance.
downcasting.
All of the above
Question 18. 18. Typecasting a pointer of type Foo into a pointer of type Bar (Points : 3)
is possible and might be useful, especially if types are related and especially in pure C programming.
can result in undefined behavior when accessing memory because of different memory structure in Foo and Bar.
can allow reading raw data from memory without typcasting Foo to type Bar.
All of the above
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. When creating a header file and a separate .cpp file, good design dictates that the header file should have as few _____ as possible (these should be in the .cpp instead). (Points : 3)
library dependencies
block comments
characters in the filename
All of the above
Question 21. 21. Consider testing if a C++ pointer named objPtr points to an object of type Type. The syntax used to determine that would be as follows. (Points : 3)
if( objPtr instanceof(Type) )
if( dynamic_cast<Type>(objPtr) )
if( size-of[objPtr,Type] )
if( try(objPtr)<Type> )
Question 22. 22. When referencing an element from a two-dimensional array, it is best to access elements in _____ order. (Points : 3)
first-in-first-out
last-in-first-out
row/col
x/y
Question 23. 23. Heap 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. An abstract base class (also called an Interface) (Points : 3)
must have a pure virtual function.
cannot be instantiated.
allows polymorphism of all inheriting types.
All of the above
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. Assert statements align with the fail-fast programming philosophy because they (Points : 3)
crash the program as soon as any error is detected.
silently mark when and where an error occurred.
prevent errors by automatically testing code.
allow the compiler to accept errors as warnings.
Question 27. 27. Preprocessor macros (Points : 3)
should be avoided if other language features will work just as well.
can easily confuse other programmers not familiar with your macro.
should be undefined after use to avoid polluting the global namespace.
All of the above
Question 28. 28. Which piece of the C/C++ compile tool chain inserts header files into compilation units? (Points : 3)
Preprocessor
Compiler
Linker
Debugger
Question 29. 29. C++ exceptions are better than C error codes because C++ exceptions (Points : 3)
maintain stack information to find exactly where errors happened.
easily handle partial-initialization with try/catch blocks.
are always much faster and more efficient than C error codes.
C++ exceptions are not better; they are just another way of handling errors.
Question 30. 30. A function template allows a function to be (Points : 3)
executed more safely than normal.
executed more quickly than normal.
called with many different types.
All of the above
Ask a question
Experts are online
Answers
Login/SignUp to view answers