Computer Science - Object Oriented Programming Using C++ MCQs Part 11
1. A function whose purpose is to send messages to other functions is known as a _____
A.
dispatcher
dispatcher
B.
courier
courier
C.
messenger
messenger
D.
sender
sender
Answer Option A
2. With commercial classes, the function source code is usually________
A.
printed on high-quality paper
printed on high-quality paper
B.
poorly written
poorly written
C.
provided on a disk
provided on a disk
D.
provided in object form
provided in object form
Answer Option D
3. The type of value that a function sends back to the function that calls it is known as its _____
A.
type
type
B.
return value
return value
C.
reference data
reference data
D.
sentinel
sentinel
Answer Option B
4. Assume that a program includes the short *agePtr = NULL; statement. The name of the pointer is _____
A.
*agePtr
*agePtr
B.
agePtr
agePtr
Answer Option B
5. Which of the following are never inherited?
A.
public data members
public data members
B.
constructor functions
constructor functions
C.
void functions
void functions
D.
overloaded + operators
overloaded + operators
Answer Option B
6. The expression c = i++ causes
A. the value of i assigned to c and then i incremented by 1
B. i to be incremented by 1 and then the value of i assigned to c
C. value of i assigned to c
D. i to be incremented by 1
E. None of the above
Answer Option A
7. An identifier in C
A. is a name of a thing such as variable and function
B. is made up of letters, numerals, and the underscore
C. can contain both uppercase and lowercase letters
D. All of the above
E. None of the above
Answer Option D
8. Which of the following creates a String named constant called partNo, whose value is AB45?
A. const char[4] partNo = "AB45";
B. const char[5] partNo = 'AB45';
C. const char[5] partNo = "AB45";
D. const char partNo[5] = "AB45";
E. None of the above
Answer Option D
9. The bitwise AND operator is represented by the symbol
A. ^
B. &
C. &&
D. >>
E. None of the above
Answer Option B
10. The exclusive OR operator gives the result 1 when
A. both the bits are 0
B. one bit is 0 and the other is 1
C. both the bits are 1
D. no hard and fast rule
E. None of the above
Answer Option B
11. A function's purpose is to print customer data. Which of the following is the best name for this function?
A. pcd(). It's short for "print customer data" and takes few keystrokes
B. Printcustomerdata(). It states everything the function will do
C. printCustomer(). It states the function's purpose and is easy to read
D. lastFunction(). It is the final function called in most programs, and this name identifies the function's timing
Answer Option C
12. The function strcmp("Jose", "JOSE") will return _____
A. - 1
B. 0
C. 1
Answer Option C
13. A pointer to void can hold pointers to
A. char type
B. int type
C. float type
D. any data type
Answer Option D
14. Which of the following is the extraction operator?
A. >>
B. <<
C. //
D. /*
E. both (a) and (b)
Answer Option A
15. The function whose prototype is void getData(Item &thing); receives
A. a pointer to a structure
B. a reference to a structure
C. a copy of a structure
D. nothing
Answer Option B
16. When a multidimensional array is accessed, each array index is
A. separated by commas
B. surrounded by brackets and separated by commas
C. separated by commas and surrounded by brackets
D. surrounded by brackets
Answer Option D
17. To create a variable, you must assign _____ to it
A. a data type
B. a name
C. both a data type and a name
D. the word var
Answer Option C
18. You indicate a variable is a pointer variable by placing a(n) _____ in front of the variable's name
A. asterisk
B. ampersand
C. dollar sign
D. exclamation point
Answer Option A
19. A function can make_________
A. one throw
B. one throw of each scalar type
C. one throw of each programmer-defined type
D. as many throws of as many types as necessary
Answer Option D
20. A default exception block must be placed _____
A. first among the catch blocks
B. last among the catch blocks
C. globally, at the top of the file
D. at the end of all code in the program
Answer Option B
21. Which of the following control structures is used in every program?
A. repetition
B. selection
C. sequence
D. switching
Answer Option C
22. In the C language, a string is assigned to the
A. char type of variable
B. string type of variable
C. conversion specification %s
D. All of the above
Answer Option A
23. Which of the following statements declares a one-dimensional Character array named item that consists of five elements?
A. char item[0 to 4] = "";
B. char item[0 to 5] = "";
C. char item[4] = "";
D. char item[5] = "";
E. string item[5] = ' ';
Answer Option D
24. A derived class may also be called a
A. subclass
B. super class
C. parent class
D. derived class
Answer Option A
25. The main() function is always
A. a called function
B. a calling function
C. recursive function
D. used at the end of the program
E. None of the above
Answer Option B
26. Variables that are known only to the function in which they are declared are called _____ variables
A. global
B. local
C. main
D. separate
E. void
Answer Option B
27. In the expression p --> val,p is a(n)
A. address
B. pointer
C. structure
D. header
Answer Option B
28. In a template function, _____ argument is generic, or parameterized
A. no
B. exactly one
C. at least one
D. more than one
Answer Option C
29. Object-oriented programmers primarily focus on _________
A. procedures to be performed
B. the step-by-step statements needed to solve a problem
C. objects and the tasks that must be performed with those objects
D. the physical orientation of objects within a program
Answer Option C
30. You define a structure type globally because
A. you save many lines of code by not rewriting an identical structure definition in each function that uses it
B. you will never change its definition
C. it is required in C++
D. all of the above
Answer Option A
31. The standard output stream, which refers to the computer screen, is called
A. cin
B. cout
C. stin
D. stout
E. None of the above
Answer Option B
32. Which of the following operators is the equality operator?
A. !=
B. =
C. ==
D. ->>
E. <>
Answer Option C
33. In C++, you use _____ to perform standard input and output operations
A. characters
B. sequences
C. streams
D. tests
Answer Option C
34. Values that are used to end loops are referred to as _____ values
A. end
B. finish
C. sentinel
D. stop
Answer Option C
35. Which of the following flowchart symbols represents the if selection structure?
A. diamond
B. hexagon
C. oval
D. parallelogram
E. rectangle
Answer Option A
36. Two or more arrays whose elements are related by their position (subscript) in the arrays are called _____ arrays
A. horizontal
B. paired
C. parallel
D. related
E. vertical
Answer Option C
37. Assume that a program creates and initializes a Short Integer variable named age and a pointer named agePtr, to which it assigns the address of the age variable. Which of the following statements will assign the number 21 to the age variable?
A. age = 21;
B. *age = 21;
C. agePtr = 21;
D. *agePtr = 21;
E. both (a) and (d)
Answer Option E
38. The statement fwrite ( (char*)&objl, sizeof(objl) );
A. writes the member functions of objl to fl
B. writes the data in objl to fl
C. writes the member functions and me data of obj 1 to fl
D. writes the address of objl to fl
Answer Option B
39. The body of a C++ function is surrounded by _____
A. parentheses
B. angle brackets
C. curly brackets
D. square brackets
Answer Option C
40. Which of the following type casts will convert an Integer variable named amount to a Double type?
A. (double) amount
B. (int to double) amount
C. int to double(amount)
D. int (amount) to double
Answer Option A
41. The loosest type of coupling is
A. data coupling
B. control coupling
C. external coupling
D. pathological coupling
Answer Option A
42. Which of the following is a string literal constant?
A. "Visual C++"
B. "137.45"
C. "A"
D. "2,365"
E. All of the above
Answer Option E
43. Which of the following, if any, are valid names for variables?
A. class
B. friend
C. #OnHand
D. void
E. None of the above are valid names for variables
Answer Option E
44. A child class _____ exist if there is no parent class
A. must
B. may
C. cannot
D. can
Answer Option C
6. The expression c = i++ causes
A. the value of i assigned to c and then i incremented by 1
B. i to be incremented by 1 and then the value of i assigned to c
C. value of i assigned to c
D. i to be incremented by 1
E. None of the above
Answer Option A
7. An identifier in C
A. is a name of a thing such as variable and function
B. is made up of letters, numerals, and the underscore
C. can contain both uppercase and lowercase letters
D. All of the above
E. None of the above
Answer Option D
8. Which of the following creates a String named constant called partNo, whose value is AB45?
A. const char[4] partNo = "AB45";
B. const char[5] partNo = 'AB45';
C. const char[5] partNo = "AB45";
D. const char partNo[5] = "AB45";
E. None of the above
Answer Option D
9. The bitwise AND operator is represented by the symbol
A. ^
B. &
C. &&
D. >>
E. None of the above
Answer Option B
10. The exclusive OR operator gives the result 1 when
A. both the bits are 0
B. one bit is 0 and the other is 1
C. both the bits are 1
D. no hard and fast rule
E. None of the above
Answer Option B
Comments
Post a Comment