Q.1

A data member holds a 1 or 0 depending on whether taxes have been paid. The best identifier for this member is _____

  • taxes
  • paidTaxes
  • taxesArePaid
  • code
Q.2

The switch variable can be of

  • int type only
  • char type only
  • both int as well as char type
  • float type only
  • None of the above
Q.3

Which of the following statements creates a named constant called driverAge whose value is 16?

  • const driverAge = 16;
  • const short driverAge = 16;
  • driverAge =16;
  • driverAge const =16;
  • namedconst driverAge =16;
Q.4

The >> (extraction) operator stops reading characters from the keyboard as soon as the user _____

  • presses the Enter key
  • types a character that is inappropriate for the variable's data type
  • both (a) and (b)
Q.5

The function whose prototype is void getData(Item *thing); receives

  • a pointer to a structure
  • a reference to a structure
  • a copy of a structure
  • nothing
Q.6

A constructor initialization list produces similar results to

  • overriding
  • assignment
  • redeclaring
  • output
Q.7

A program will have one function prototype for each function defined in the programmer-defined section of the program. (Assume that the programmer-defined section is located below the main function.)

  • true
  • false
Q.8

To include the double quotes as part of the control string we use the symbol

  • %"
  • ""
  • \"
  • #
  • None of the above
Q.9

The difference between a return and a throw is that _____

  • with a throw, no value can be sent
  • with a return, no value can be sent
  • with a throw, execution takes place at the location from which the function was called
  • with a return, execution takes place at the location from which the function was called
Q.10

You can use the C++ _____ function to assign a value to a String variable

  • assign
  • copy
  • string
  • strcopy
  • strcpy
Q.11

Which of the following is a valid condition for an if statement? (The condition should be both syntactically and logically valid.)

  • (age) > 65
  • (age > 0 and < 10)
  • (sales > 500 && < 800)
  • (sales > 100 && sales <= 1000)
  • (sales > 100 || sales <= 1000)
Q.12

Any output manipulator function you create _____

  • should take as an argument an instance of ostream as a reference
  • should return void
  • must be a member function of the ostream class
  • must inherit ostream
Q.13

Which of the following formulas can be used to generate random integers between 1 and 10?

  • 1 + rand() % (10 - 1 + 1)
  • 1 + (10 - 1 + 1) % rand()
  • 10 + rand() % (10 - 1 + 1)
  • 10 + rand() % (10 + 1)
Q.14

An expression contains relational, assignment and arithmetic operators. In the absence of parentheses, the order of evaluation will be

  • assignment, relational, arithmetic
  • arithmetic, relational, assignment
  • relational, arithmetic, assignment
  • assignment, arithmetic, relational
  • None of the above
Q.15

The number of structures than can be declared in a single statement is

  • one
  • two
  • three
  • unlimited
Q.16

The rules of a programming language are called its _____

  • code
  • guidelines
  • procedures
  • regulations
  • syntax
Q.17

The C++ keyword for declaring a variable that contains a decimal point is _____

  • dec
  • decimal
  • float
  • floater
  • None of the above
Q.18

A pointer is

  • the address of a variable
  • an indication of the variable to be accessed next
  • a variable for storing addresses
  • the data type of an address variable
Q.19

Inheritance is the principle that

  • Classes with the same name must be derived from one another
  • Knowledge of a general category can be applied to more specific objects
  • C++ functions may be used only if they have logical predecessors
  • One function name may invoke different methods
Q.20

A function that uses variable types is called __________

  • overloaded
  • a template function
  • a variable function
  • a virtual function
Q.21

Assume a class Derv that is privately derived from class Base. An object of class Derv located in main() can access

  • public members of Base
  • protected members of Base
  • private members of Base
  • public members of Derv
Q.22

Reference variables and const class members _____

  • must be assigned values in any derived class
  • must never be initialized in a base class
  • must be initialized, rather than assigned values
  • must not exist if a class is to be a base class
Q.23

Which functions do not have a this pointer?

  • access functions
  • inspector functions
  • member functions
  • static functions
Q.24

In the statement template<class T>,

  • T is a class
  • T is a scalar variable
  • either (a) or (b)
  • neither (a) nor (b)
Q.25

Variables that are declared in a block are known as _____ variables to that block

  • confined
  • local
  • global
  • immediate
Q.26

The standard input stream, which refers to the keyboard, is called

  • cin
  • cout
  • stin
  • stout
  • None of the above
Q.27

A C++ statement must end in a

  • : (column)
  • , (comma)
  • . (period)
  • ; (semicolon)
Q.28

Which is a good reason for passing a variable's address to a function?

  • the function will have a copy of the variable
  • the function cannot change the value of the variable in the calling function
  • C++ requires that all variables used in a function be passed by address
  • the function needs to change multiple variable values
  • the called function can change the value of the variable in the calling function
Q.29

A measure of the strength of the connection between two functions is

  • cohesion
  • coupling
  • dependence
  • subjection
Q.30

A pattern for creating an object is called a(n) _____

  • private
  • class
  • attributes
  • public
Q.31

To pass an array by reference, you

  • must include the address-of (&) operator before the array's name
  • must include the number symbol (#) before the array's name
  • do not have to do anything because arrays are automatically passed by reference
Q.32

Format flags may be combined using the _____

  • bitwise OR operator(|)
  • logical OR operator (||)
  • bitwise AND operator (&)
  • logical AND operator (&&)
Q.33

You have declared an integer pointer called point You have also declared an integer called number. Which statement is the correct format?

  • point = number;
  • point = *number;
  • point = &number;
  • point = +number;
Q.34

The keyword virtual indicates that

  • a derived class has public access to a base class
  • more than one base class exists
  • a base class should be used only once in inheritance
  • a derived class should have more than one base class constructed
Q.35

The cout << sales[+ sales[1]; statement will______

  • display 22000
  • display 10000 + 12000
  • display sales[0] + sales[l]
  • result in an error
Q.36

An array element is accessed using

  • a first-in-first-out approach
  • the dot operator
  • a member name
  • an index number
Q.37

Having more than one function with the same name is called

  • overloading
  • defaulting
  • casting
  • referencing
Q.38

Which of the following is an access specifier?

  • particular
  • shielded
  • protected
  • safe
Q.39

You can code a default exception handler by creating a catch block

  • with no arguments
  • with a void argument
  • with an ellipsis as its argument
  • with an argument identical to that thrown
Q.40

The null character is represented by

  • \n
  • \0
  • \o
  • \r
  • None of the above
Q.41

The pow and sqrt functions return a(n) _____ type number

  • double
  • float
  • integer
  • long
  • short
Q.42

You can throw _____

  • a scalar variable
  • a constant
  • a programmer-defined class object
  • any of these
Q.43

A static data member is given a value

  • within the class definition
  • outside the class definition
  • when the program is executed
  • never
Q.44

If the code and fee arrays are parallel, the fee that corresponds to the code stored in the code[element is located in the _____ element

  • code[2]
  • code[3]
  • fee[2]
  • fee[3]
Q.45

Local variables _____

  • are created outside a block
  • are known only to that block
  • continue to exist when their block ends
  • are illegal in C++
Q.46

Student senior(); is a(n)_________

  • constructor call with no arguments
  • object instantiation
  • constructor call with all default arguments
  • prototype for a function that returns a student object
Q.47

One of the valid escape sequences used in the C language is

  • \z
  • \N
  • \t
  • \s
  • None of the above
Q.48

Programmer-defined functions can be

  • value-returning functions only
  • void functions only
  • either value-returning or void functions
Q.49

The string HELLO WORLD needs

  • 11 bytes
  • 12 bytes
  • 10 Bytes
  • 8 bytes
  • None of the above
Q.50

If you want to override constructor default values for an object you are instantiating, you must also override

  • all other parameters to that constructor
  • all parameters to the left of that value
  • all parameters to the right of that value
  • no other parameters to that constructor
0 h : 0 m : 1 s