Accounting
Anthropology
Archaeology
Art History
Banking
Biology & Life Science
Business
Business Communication
Business Development
Business Ethics
Business Law
Chemistry
Communication
Computer Science
Counseling
Criminal Law
Curriculum & Instruction
Design
Earth Science
Economic
Education
Engineering
Finance
History & Theory
Humanities
Human Resource
International Business
Investments & Securities
Journalism
Law
Management
Marketing
Medicine
Medicine & Health Science
Nursing
Philosophy
Physic
Psychology
Real Estate
Science
Social Science
Sociology
Special Education
Speech
Visual Arts
Programming Language
Q:
Which of the following is not one of the six logical units of a computer?
a. Input unit.
b. Output unit.
c. Central processing unit.
d. Printer.
Q:
Which of the following is most closely associated with Moore's Law?
a. Every year or two, the price of computers has approximately doubled.
b. Object-oriented programming uses less memory than previous software-development methodologies.
c. Demand for communications bandwidth is decreasing dramatically each year.
d. Every year or two, the capacities of computers have approximately doubled without any increase in price.
Q:
Which of the following statements is false?
a. Cloud computing allows you to use software, hardware and information stored in the "cloud"i.e., accessed on remote computers via the Internet and available on demandrather than having it stored on your personal computer.
b. Cloud computing services allow you to increase or decrease resources to meet your needs at any given time, so they can be more cost effective than purchasing expensive hardware to ensure that you have enough storage and processing power to meet your needs at their peak levels.
c. Businesses using cloud computing services must still manage the applications, which can be costly.
d. Both (a) and (c).
Q:
Which of the following statements is false?
a. Cloud computing allows you to use software, hardware and information stored on remote computers via the Internet and available on demandrather than having it stored on your personal computer.
b. Electronic health records enable health care providers to share patients' information across a secure network, improving patient care, reducing the probability of error and increasing overall efficiency of the health care system.
c. Global Positioning System (GPS) devices a single satellite to retrieve location-based information.
d. The Human Genome Project was founded to identify and analyze the 20,000+ genes in human DNA.
Q:
Which of the following statements is false?
a. Object-oriented programming is today's key programming methodology.
b. C++ is standardized worldwide through the International Organization for Standardization.
c. Hardware controls software.
d. There are now more mobile devices than people in the world.
Q:
Which of the following statements is false?
a. Object-oriented programming is today's key programming methodology.
b. C++ is one of today's most popular software development languages.
c. Software commands computer hardware to perform tasks.
d. In use today are more than a trillion general-purpose computers and trillions more cellphones, smartphones and other handheld devices.
Q:
Q2: Assuming that all four of the following functions are defined, which one will be called by the function call square( 23. )?
a. template< typename T >
T square( T num )
b. template< typename T1, typename T2 >
T1 square( T1 num1, T2 num2 )
c. int square( int num )
d. double square( double num )
Q:
Q1: A function template can be overloaded by:
a. Using other function templates with the same function name and parameters.
b. Using non-template functions with the same name and different parameters.
c. Using non-template functions with a different name but the same parameters.
d. Using other function templates with a different name but the same parameters.
Q:
Q2: Default type parameters are allowed only:
a. If the class template also has nontype parameters.
b. If the class template does not have any nontype parameters.
c. If the class is used as a container class.
d. As the rightmost (trailing) parameters in a template's type-parameter list.
Q:
Q1: Which of the following is true?a. Only class templates may specify default type arguments for type parameters.b. Only function templates may specify default type arguments for type parameters.c. Both class templates and function templates may specify default type arguments for type parameters.d. None of the above.
Q:
Q1: Nontype parameters are:
a. Unable to have default arguments.
b. Specified before the angle-bracket-enclosed type-parameter list.
c. Constants.
d. Required for class templates.
Q:
Q3: Function templates:
a. Can include objects of template classes as parameters.
b. Must have return type T.
c. Do not need a separate template< typename type >statement if they take objects from a template class as a parameter.
d. Do not need a separate template< typename type >statement.
Q:
Q2: For a class template, the scope resolution operator (::) is needed:
a. Only in the definitions of the member functions defined outside the class.
b. Both in the prototype and definition of a member function.
c. Only if multiple class-template specializations will be created from this class template.
d. In neither the definition nor prototype of member functions.
Q:
Q1: Class templates:
a. May include the statement template< typename Type >anywhere.
b. Must put template< typename Type >before the class definition.
c. Must include template< typename Type >inside the class definition.
d. Have the option of including the optional statement template< typename Type >.
Q:
Q1: The relationship between function templates and function-template specializations is most similar to the relationship between:
a. Classes and objects.
b. Classes and functions.
c. Functions and return types.
d. Headers and source files.
Q:
Q2: Which class indicates that an error occurred in which an arithmetic result was larger than the largest number that can be stored in the computer?
a. invalid_argument.
b. bad_exception.
c. out_of_range.
d. overflow_error.
Q:
Q1: Select the false statement regarding exceptions.
a. The C++ standard has a hierarchy of exception classes.
b. All exception classes are accessible via <exception>.
c. Several classes derive from class exception.
d. The what function can be overridden in each class derived from exception.
Q:
Q2: Which statement about class unique_ptr (of the new C++ standard) and dynamic memory allocation is false?
a. An object of class unique_ptr maintains a pointer to dynamically allocated memory.
b. When a unique_ptr object destructor is called (for example, when a unique_ptr object goes out of scope), it performs a destroy operation on its pointer data member.
c. Class template unique_ptr provides overloaded operators * and -> so that a unique_ptr object can be used just as a regular pointer variable is.
d. Class unique_ptr is part of the new C++ standard and it replaces the deprecated auto_ptr class.
Q:
Q1: If dynamic memory has been allocated for an object and an exception occurs, then:
a. The catch block will not work properly.
b. A memory leak could result.
c. The object's constructor will cause another exception.
d. Multiple pointers to memory could be created.
Q:
Q2: Select the false statement. The new operator:
a. Can attempt to allocate as much memory as the programmer requests.
b. Returns a pointer to a location in memory.
c. Can indicate failure differently on different compilers.
d. Throws a bad_alloc exception regardless of what function is registered with set_new_handler.
Q:
Q1: Select the false statement. Depending on the compiler:
a. A failed new operation can return a 0.
b. A failed new operation can throw a bad_alloc exception.
c. A failed new operation can throw an exception if the <new> header file has been included.
d. A failed new operation can automatically be caught at compile time.
Q:
Q1: An advantage of using inheritance with exceptions is:
a. The ability to catchrelated errors easily.
b. Allowing catch statements to be imported into classes.
c. The ability to explicitly test for derived class objects individually.
d. The simplification of destructor calls for objects.
Q:
Q1: Select the false statement. If an exception is thrown from a constructor:
a. The object being constructed will not be constructed.
b. For an array, destructors for all array elements are called, even if those array elements have not yet been constructed.
c. The exception can contain the error information that the constructor would not be able to return in the normal manner.
d. For an object with member objects, and whose outer object has not been constructed, the destructor is called for the member objects.
Q:
Q1: Exception handling should not be used:
a. As an alternative for program control.
b. To make error handling uniform on large projects.
c. To deal with errors that do not arise very often.
d. To deal with errors for components that will be widely used in other applications, such as classes and libraries.
Q:
Q1: The purpose of stack unwinding is to:a. Attempt to catch exceptions that are not caught in their scope.b. Improve catchblocks by allowing them to handle multiple exceptions.c. Return control to the function that created the exception.d. Aid the terminate command in shutting down the program.
Q:
Q2: Select the false statement. A rethrown exception:
a. Is detected by the next enclosing try block.
b. Is the immediate result of a throwcommand.
c. Can be processed by exception handlers following the enclosing try block.
d. Must have been fully processed at the time it was rethrown.
Q:
Q1: To rethrow an exception, the exception handler must:
a. Use the throw; statement.
b. Use the throw command with the same parameters as the original exception.
c. Return a reference to whatever caused the original exception.
d. Not have attempted to process that exception at all.
Q:
Q5: An exception:
a. Terminates program execution.
b. Terminates the block where the exception occurred.
c. Will terminate the block where the exception occurred unless a catch command stops it.
d. Will not terminate a block unless explicitly instructed to do so.
Q:
Q4: catch blocks are not required to contain:
a. Braces { }.
b. Parentheses ( ).
c. Some form of parameter type indication.
d. A parameter name.
Q:
Q3: The try block cannot:
a. Enclose the code that may throw the exception.
b. Enclose its own catch blocks.
c. Test enclosing try blocks for additional catch statements if this try block's catch statements can"t match the exception being thrown.
d. Have exceptions explicitly or implicitly thrown in the try block itself.
Q:
Q2: Once an exception is thrown, when can control return to the throw point?
a. Never.
b. Only after the exception is caught.
c. Once the stack unwinding process is completed.
d. Immediately after the exception is thrown.
Q:
Q1: The correct order in which an exception is detected and handled is:
a. try, catch, throw
b. throw, catch, try
c. catch, throw, try
d. try, throw, catch
Q:
Q1: Exception handling may allow a program to:
a. Terminate in a controlled manner.
b. Be more robust and fault-tolerant.
c. Continue executing as if no problem was encountered.
d. All of the above.
Q:
Q2: Untying an input stream, inputStream, from an output stream, outputStream, is done with the function call:
a. inputStream.untie().
b. inputStream.untie( &outputStream ).
c. inputStream.tie().
d. inputStream.tie( 0 ).
Q:
Q1: Select the false statement. Outputs are:
a. Flushed automatically at the end of a program.
b. Flushed when the buffer fills.
c. Able to be synchronized with inputs.
d. Never automatically tied to inputs.
Q:
Q2: The difference between the operator! member function and the operator void* member function is that:
a. They always return opposite boolean values.
b. They occasionally return opposite boolean values.
c. Of the two member functions, only operator! checks if eof has been set.
d. Of the two member functions, only operator void* checks if eof has been set.
Q:
Q1: The good member function will return false if:
a. The eof member function would return true.
b. The bad member function would return true.
c. The failbit member function would return true.
d. Any of the above.
Q:
Q1: To reset the format state of the output stream:a. Call the reset member function.b. Call the flags member function with the ios_base::fmtflags constant as the argument.c. 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.d. You must manually apply each individual format change member function or stream manipulator to restore the default format state.
Q:
Q1: Which of the following is not true about bool values and how they're output with the output stream?
a. The old style of representing true/false values used -1 to indicate false and 1 to indicate true.
b. A bool value outputs as 0 or 1 by default.
c. Stream manipulator boolalpha sets the output stream to display bool values as the strings "true" and "false".
d. Both boolalpha and noboolalpha are "sticky" settings.
Q:
Q1: Which of the following outputs does not guarantee that the uppercase flag has been set?
a. All hexadecimal numbers appear in the form 0X87.
b. All numbers written in scientific notation appear the form 6.45E+010.
c. All text outputs appear in the form SAMPLE OUTPUT.
d. All hexadecimal numbers appear in the form AF6.
Q:
234500e-003
Q:
Q1: What will be output by the following statements?double x = .0012345;cout << fixed << x << endl;cout << scientific << x << endl;a. 1.234500e-0030.001235b. 1.23450e-0030.00123450c. .0012351.234500e-003d. 0.001234501.23450e-003
Q:
Q1: When the showbase flag is set:
a. The base of a number precedes it in brackets.
b. Decimal numbers are not output any differently.
c. "oct" or "hex" will be displayed in the output stream.
d. Octal numbers can appear in one of two ways.
Q:
Q1: Which of the following statements restores the default fill character?
a. cout.defaultFill();
b. cout.fill();
c. cout.fill( 0 );
d. cout.fill( ' ' );
Q:
Q1: 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?
a. left
b. right
c. internal
d. showpos
Q:
Q1: What will be output by the following statement?
cout << showpoint << setprecision(4) << 11.0 << endl;
a. 11
b. 11.0
c. 11.00
d. 11.000
Q:
Q1: Which of the following is a valid user-defined output stream manipulator header?
a. ostream& tab( ostream& output )
b. ostream tab( ostream output )
c. istream& tab( istream output )
d. void tab( ostream& output )
Q:
Q1: Which of the following is not true about setw and width?
a. If the width set is not sufficient the output prints as wide as it needs.
b. They are used to set the field width of output.
c. Both of them can perform two tasks, setting the field width and returning the current field width.
d. They only apply for the next insertion/extraction.
Q:
Q1: 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;
a. 1.2346
1.23
1.23
b. 1.23457
1.235
1.23456789
c. 1.2346
1.23
1.23456789
d. 1.23457
1.235
1.235
Q:
Q1: Which of the following is not a difference between hex and setbase?a. setbase is a parameterized stream manipulator and hex is not.b. setbase is provided by a different header file than hex.c. setbase(16) and hex have different effects on stream output.d. setbase takes an argument but hex does not.
Q:
Q1: Which of the following is a difference between the read and write functions?a. One performs formatted I/O and the other does not.b. They take different types of parameters.c. write and gcount are member functions of the same class, whereas read is not.d. The failbit is set only with read.
Q:
Q1: If unexpected data is processed in an I/O operation:
a. An exception will be thrown.
b. An error message will automatically be displayed.
c. The program will terminate execution.
d. Various error bits will be set.
Q:
Q2: Upon encountering the designated delimiter character, the ignore member function will:
a. Read it in and return its value.
b. Ignore it and continue reading and discarding characters.
c. Terminate.
d. Replace it with an EOF character.
Q:
Q1: The putback member function returns to the input stream the previous character obtained by:a. A get from the input stream.b. Using the stream extraction operator on the input stream.c. Reading input from the keyboard.d. Reading a file from disk.
Q:
Q1: One difference between the three-argument version of the get function and the getline function is that:a. Only get has a delimiter.b. The getline function removes the delimiter from the stream.c. Only get adds the delimiter to the array.d. getline stores the characters it reads into its character array argument.
Q:
Q1: The stream-extraction operator:a. Does not normally accept white-space characters.b. Returns true when the end-of-file is encountered.c. Sets the stream's failbit if the operation fails.d. Sets the stream's badbit if the data is of the wrong type.
Q:
Q1: Which of the following is an illegal use of function put?
a. cout.put( 'A' );
b. cout.put( "A" );
c. cout.put( 'A' ).put( '
' );
d. cout.put( 65 );
Q:
Q1: Which of the following prints the address of character string string given the following declaration?
char * string = "test";
a. cout << string;
b. cout << *&string;
c. cout << static_cast< void * >( string );
d. cout << * string;
Q:
Q1: Which of the following is not a member function of the C++ ostream class?
a. Stream-insertion operator (<<).
b. Stream-extraction operator (>>).
c. put.
d. write.
Q:
.3 Q3: Which of the following classes is deepest in the inheritance hierarchy?
a. basic_iostream
b. basic_ofstream
c. basic_ifstream
d. basic_fstream
Q:
Q2: Which of the following is not an object of the ostream class?
a. cout
b. cerr
c. cin
d. clog
Q:
Q1: Which of the following classes is a base class of the other three?
a. basic_ios
b. basic_istream
c. basic_ostream
d. basic_iostream
Q:
Q2 [C++11] Which of the following statements is false?
a. The C++ standard redesigned the classic C++ stream classes, which processed only chars, as class templates with specializations for processing characters of types char and wchar_t, respectively.
b. C++11 added type char64_t to handle the new double-width Unicode characters.
c. The size of type wchar_t is not specified by the C++ standard.
d. C++11's new char16_t and char32_t types for representing Unicode characters were added to provide character types with explicitly specified sizes.
Q:
Q1: Which C++ data type was designed to store Unicode characters?
a. char
b. long
c. wchar_t
d. size_t
Q:
Q2: __________ is usually faster than __________.
a. High-level I/O, low-level I/O.
b. Low-level I/O, high-level I/O.
c. Low-level I/O, internal data processing.
d. High-level I/O, internal data processing.
Q:
Q1: Select the correct statement regarding C++ I/O streams:
a. C++ provides only high-level I/O capabilities because it is a high-level programming language.
b. High-level (formatted) I/O is best for large-volume transfers.
c. Low-level I/O breaks information down into small, meaningful groups of related bytes.
d. Programmers generally prefer high-level I/O to low-level I/O.
Q:
Q1: Which of the following statements is not true about C++ input/output (I/O) features?
a. C++ allows users to specify I/O for their own data types.
b. C++ automatically calls the correct I/O operations for standard types.
c. C++ has some object-oriented I/O features.
d. C++ borrowed its type safe I/O capabilities from C.
Q:
Q1: virtual destructors must be used when:a. The constructor in the base class is virtual.b. delete is used on a base-class pointer to a derived-class object.c. delete is used on a derived-class object.d. A constructor in either the base class or derived class is virtual.
Q:
Q4: dynamic_cast is often used to:
a. Perform type checking for objects.
b. Convert pointers to strings.
c. Upcast pointers.
d. Downcast pointers.
Q:
Q3: The __________ operator returns a reference to a __________ object:
a. typeid, type_info
b. typeinfo, type_id
c. typeid, data_type
d. typeinfo, type
Q:
Q2: Run-time type information can be used to determine:
a. A function's return type.
b. A function's argument type.
c. An object's type.
d. The number of arguments a function takes.
Q:
Q1: The line:
virtual double functionX() const = 0;
in a class definition indicates that the class is probably a:
a. Base class.
b. Derived class.
c. Protected class.
d. Library class.
Q:
Q4: Abstract classes do not necessarily have:
a. A 0 pointer in their vtable.
b. A virtual function prototype with the notation = 0.
c. Zero instances of their class.
d. Zero references to their class.
Q:
Q3: The C++ compiler makes objects take up more space in memory if they:
a. Are derived from base classes.
b. Have virtual functions.
c. Have only protected members.
d. Are referenced by pointers.
Q:
Q2: Concrete classes that inherit virtual functions but do not override their implementations:
a. Have vtables which are the same as those of their base classes.
b. Receive their own copies of the virtual functions.
c. Receive pointers to their base classes' virtual functions.
d. Receive pointers to pure virtual functions.
Q:
Q1: An abstract class will:
a. Have all zero function pointers in its vtable.
b. Have at least one zero function pointer in its vtable.
c. Share a vtable with a derived class.
d. Have fewer zero function pointers in its vtable than concrete classes have.
Q:
Q1: 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;
};
a. There are no pure virtual functions.
b. There is a non-virtual function.
c. private variables are being accessed by a public function.
d. Nothing, it functions fine as an abstract class.
Q:
Q4: Which of the following is not allowed?
a. Objects of abstract classes.
b. Multiple pure virtual functions in a single abstract class.
c. References to abstract classes.
d. Arrays of pointers to abstract classes.
Q:
Q3: The main difference between a pure virtual function and a virtual function is:a. The return type.b. The member access specifier.c. That a pure virtual function cannot have an implementation.d. The location in the class.
Q:
Q2: Abstract classes:
a. Contain at most one pure virtual function.
b. Can have objects instantiated from them if the proper permissions are set.
c. Cannot have abstract derived classes.
d. Are defined, but the programmer never intends to instantiate any objects from them.