C Tutorial for Beginners Online Computer Test - Set 16 - ObjectiveBooks

C Tutorial for Beginners Online Computer Test - Set 16

Practice Test: Question Set - 16


1. Which of the following while clause will stop the loop when the value in the age variable is less than the number 0?
    (A) while age < 0
    (B) while (age < 0)
    (C) while age >= 0;
    (D) while (age >= 0)

2. The type of value that a function sends back to the function that calls it is known as its _______
    (A) Type
    (B) Return value
    (C) Reference data
    (D) Sentinel

3. ________ variables remain in memory until the statement block ends
    (A) Area
    (B) Global
    (C) Local
    (D) Reference

4. If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is
    (A) int
    (B) double
    (C) Either (a) or (b)
    (D) Neither (a) nor (b)

5. 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

6. One drawback to returning an error code from a function is ________
    (A) Functions cannot return error codes
    (B) Error codes must be integers, and some functions can't return an integer
    (C) A function can return only one value, so it can return only the error code
    (D) A function that returns an error code will identify all returns as errors

7. Variables declared outside a block are called _______
    (A) Global
    (B) Universal
    (C) Stellar
    (D) External

8. 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

9. The general principle underlying object-oriented error handling is that a called function should ________
    (A) Neither check for, nor handle errors
    (B) Check for errors but not be required to handle any detected
    (C) Handle errors, but not check for them
    (D) Both check for and handle errors

10. A constructor always has
    (A) Communicational cohesion
    (B) Temporal cohesion
    (C) Logical cohesion
    (D) No cohesion

11. Values that are used to end loops are referred to as _______ values
    (A) End
    (B) Finish
    (C) Sentinel
    (D) Stop

12. A constructor may be ________
    (A) Provided automatically by C++
    (B) Written by you
    (C) Either (a) or (b)
    (D) Neither (a) nor (b)

13. "C++" is a _______ constant
    (A) Character literal
    (B) Named literal
    (C) Numeric literal
    (D) String literal

14. 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

15. Assume you want to compare the character stored in the initial variable to the letter a. Which of the following conditions should you use in the if statement? (Be sure the condition will handle a or A).
    (A) (initial = 'a' or 'A')
    (B) (initial == 'a' or 'A')
    (C) (toupper(initial) = 'A')
    (D) (toupper(initial) == 'A')

Show and hide multiple DIV using JavaScript View All Answers

 Next Tests: