CISP 400 STUDY GUIDE PART 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which file open mode would be used to write data only at the end of an existing file?

ios::app

To write fixed-length records, use file open mode:

ios::binary

Input operations are supported by _________ class.

istream

Which of the following is not true about files?

istream, ostream and iostream are derived from ifstream, ofstream and fstream, respectively.

The stream manipulators for justification are ________ , __________ and ____________.

left, right, internal

Data loss could occur if the contents of a __________ were placed into any of the other three associative container types.

multimap

Member function _________ of the file streams fstream, ifstream and ofstream opens a file.

open

[C++11]: Overloaded operators can be used to test a stream's state in conditions. The operator! member function, inherited into the stream classes from class basic_ios, returns true if the badbit, the failbit or both are true. The ________ member function (added in C++11) returns false if the badbit is true, the failbit is true or both are true.

operator bool

Which of the following is a valid user-defined output stream manipulator header?

ostream& tab(ostream& output)

Which of the following is not a difference between hex and setbase?

setbase(16) and hex have different effects on stream output.

Input/output in C++ occurs as ______________ .

streams of bytes

Polymorphism helps eliminate ___________ logic.

switch

Which of the following bitset member functions cannot be called with an empty argument list?

test

Operator typeid returns a reference to a(n) _____________ object.

type_info

The __________ operator returns a reference to a __________ object:

typeid, type_info

Overridable functions are declared using keyword _______________.

virtual

to draw themselves, the draw function would most likely be declared:

virtual

Polymorphism is implemented via:

virtual functions and dynamic binding.

Which C++ data type was designed to store Unicode characters?

wchar_t

The ostream member function ___________ is used to perform unformatted output.

write

Employee is a base class and HourlyWorker is a derived class, with a redefined non-virtual print function. Given the following statements, will the output of the two print function calls be identical? HourlyWorker h; Employee *ePtr = &h; ePtr->print(); ePtr->Employee::print();

yes

The putback member function returns to the input stream the previous character obtained by:

A get from the input stream.

The line: virtual double earnings() const = 0; appears in a class definition. You cannot deduce that:

All classes that directly inherit from this class will override this method.

Which of the following does not have a stream associated with it?

All of the above have streams associated with them.

Which of the following outputs does not guarantee that the uppercase flag has been set?

All text outputs appear in the form SAMPLE OUTPUT.

Run-time type information can be used to determine:

An object's type.

The good member function will return false if:

Any of the above.

Select the false statement. Outputs are:

Never automatically tied to inputs.

virtual functions must:

Be declared virtual in the base class.

Which of the following are mutating-sequence algorithms defined in the Standard Library?

Both first and second.

Which of the following is not true about setw and width?

Both of them can perform two tasks, setting the field width and returning the current field width.

Which of the following statements is not true about C++ input/output (I/O) features?

C++ borrowed its type safe I/O capabilities from C.

[C++11] Which of the following statements is false?

C++11 added type char64_t to handle the new double-width Unicode characters.

Problems using switch logic to deal with many objects of different types do not include:

Not being able to implement separate functions on different objects.

Which of the following is not allowed?

Objects of abstract classes

One difference between the three-argument version of the get function and the getline function is that:

The getline function removes the delimiter from the stream.

Which of the following is not true about bool values and how they're output with the output stream?

The old style of representing true/false values used -1 to indicate false and 1 to indicate true.

When the showbase flag is set:

Decimal numbers are not output any differently.

The stream-extraction operator:

Does not normally accept white-space characters.

dynamic_cast is often used to

Downcast pointers.

Which category of iterators combines the capabilities of input and output iterators into one iterator?

Forward iterators.

Which of the following statements is false?

Functions rbegin and rend return iterators that can be used to modify data, and rcbegin and rcend return const iterators that cannot be used to modify data.

An abstract class will:

Have at least one zero function pointer in its vtable.

The C++ compiler makes objects take up more space in memory if they:

Have virtual functions.

Which of the following statement is true?

If a base class declares a pure virtual function, a derived class must implement that function to become a concrete class.

[C++11]: Which of the following statements is true?

In C++11, only classes that are not declared as final can be used as base classes.

__________ is usually faster than __________.

Low-level I/O, high-level I/O.

Downcasting enables:

Making a base-class pointer into a derived-class pointer.

What mistake prevents the following class declaration from functioning properly as an abstract class? class Shape { public: virtual double print() const; double area() const {return base * height;} private: double base; double height; };

There are no pure virtual functions.

The difference between the operator! member function and the operator void* member function is that:

They always return opposite boolean values.

Which of the following statements about virtual functions is false?

They do not remain virtual down the inheritance hierarchy.

When used with ofstream objects, operator! is not:

Used to close a file explicitly.

As of C++14, the argument to find (and other similar functions) can be of any type, provided that there are overloaded comparison operators that can compare values of the argument's type to values of the container's key type. If there are, no temporary objects will be created. This is known as ________ lookup.

heterogenous

Untying an input stream, inputStream, from an output stream, outputStream, is done with the function call:

inputStream.tie(0).

Which of the following stream manipulators causes an outputted number's sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters?

internal

Stream Input/Output member function __________ can be used to set and reset format state.

flags

What will be output by the following statements? double x{.0012345}; cout << fixed << x << endl; cout << scientific << x << endl;

0.001234 1.234500e-03

What will be output by the following statements? double x{1.23456789}; cout << fixed; cout << setprecision(5) << x << endl; cout.precision(3); cout << x << endl; cout << x << endl;

1.23457 1.235 1.235

What will be output by the following statement? cout << showpoint << setprecision(4) << 11.0 << endl;

11.00

When using parameterized manipulators, the header __________ must be included.

<iomanip>

Most C++ programs that do I/O should include the ___________header that contains the declarations required for all stream-I/O operations.

<iostream>

Abstract classes:

Are defined, but the programmer never intends to instantiate any objects from them.

Which of the following assignments would be a compilation error?

Assigning the address of a base-class object to a derived-class pointer.

The line: virtual double functionX() const = 0; in a class definition indicates that the class is probably a:

Base class.

______________________ involves using a base-class pointer or reference to invoke virtual functions on base-class and derived-class objects.

Polymorphism

Which of the following statements about polymorphism is false?

Polymorphism enables you to deal in specifics and let the execution-time environment concern itself with the generalities.

Select the correct statement regarding C++ I/O streams:

Programmers generally prefer high-level I/O to low-level I/O.

Concrete classes that inherit virtual functions but do not override their implementations:

Receive pointers to their base classes' virtual functions.

To reset the format state of the output stream:

Save a copy of the fmtflags value returned by calling member function flags before making any format changes, and then call flags again with that fmtflags value as the argument.

Which of the following is not a member function of the C++ ostream class?

Stream-extraction operator (>>).

Upon encountering the designated delimiter character, the ignore member function will:

Terminate

The main difference between a pure virtual function and a virtual function is:

That a pure virtual function cannot have an implementation.

Which of the following statement is true?

The ++ operation on an iterator moves it to the container's next element.

Which of the following statement is false?

The container member function cbegin returns an iterator that refers to the container's first element.

Which of the following is a difference between the read and write functions?

The failbit is set only with read.

Abstract classes do not necessarily have:

Zero references to their class.

If a class contains at least one pure virtual function, it's a(n) _________ class.

abstract

Which of the following is not a sequence container provided by the Standard Library?

array

The sequence containers and ____________ containers are collectively referred to as the firstclass containers.

associative

Which bitset function could be used to create the logical not of a bitset object b?

b.flip()

Which of the following classes is deepest in the inheritance hierarchy?

basic_fstream

Which of the following classes is a base class of the other three?

basic_ios

Treating a base-class object as a derived-class object __________________.

can cause errors

Standard error stream outputs are directed to the stream objects ________ or _________.

cerr or clog

Which of the following is not an object of the ostream class?

cin

Which of the following would not be a member function that derived classes Fish, Frog and Bird should inherit from base class Animal and then provide their own definitions for, so that the function call can be performed polymorphically?

flapWings

Classes from which objects can be instantiated are called __________ classes.

concrete

Which of the following prints the address of character string string given the following declaration? char* string{"test"};

cout << static_cast<void*>(string)

Which of the following statements restores the default fill character?

cout.fill(' ');

Which of the following is an illegal use of function put?

cout.put("A");

virtual destructors must be used when:

delete is used on a base-class pointer to a derived-class object.

Casting a base-class pointer to a derived-class pointer is called _______________.

downcasting

Operator _________ can be used to downcast base-class pointers safely.

dynamic_cast

Which of the following will not change the file-position pointer to the same position as the others? Assume a 10-byte file size and a current position at byte # 1.

fileObject.seekg(8, ios::end);


Kaugnay na mga set ng pag-aaral

APR Exam Practice Questions Set 01

View Set

10- PROJECT COMMUNICATIONS MANAGEMENT

View Set

Parallel and Perpendicular Slopes and Equations

View Set

PSYCH 11: Week 3 Infancy and Toddlerhood

View Set

AP Human Geography Chapter 10/11

View Set

EXAM III: Chapter 12 - Adaptive Immunity

View Set

10.5 - Functional Groups - Part 2

View Set

Chapter 1 - Elements of the Immune System and Their Roles

View Set

Hematologic/ HIV Practice Questions

View Set

1.12 Dalton's Law of Partial Pressures

View Set

Ma meilleure amie, mon caractère

View Set

Intro to Bus. Chapter 13, Marketing 4, Chapter 16, Chapter 16, Marketing Chapter 17, HRIM 442 Ch 17 Exam 3, Marketing Ch 17, Marketing Ch 17-19, Marketing Chapter 17 & 18, Marketing Chapter 17, mkt ch 16, Marketing 4, MKT 301 - Ch. 16, Marketing Chap...

View Set

speed of light and Doppler effect

View Set