Answers Already Rated A+
The class X contains two data members: an integer called xVal and a float
called xPerc. Which of the following is NOT a valid prototype for the class
definition for X?
a. void X( int, float );
b. void setxVal( int );
c. float getxPerc();
d. X( int, float );
e. void printX(); - ✔✔a. void X( int, float );
An instance of a class is known as a/an __________.
a. variable
b. method
c. object
d. thing - ✔✔c. object
1
©JOSHCLAY 2024/2025. YEAR PUBLISHED 2024.
,The :: operator is used to associate a method with a specific class.
a. true
b. false - ✔✔a. true
Which of the following statements (a-d) about classes is true?
a. A class can contain both data members and methods
b. The members of a class may be private or public
c. The name of the constructor is always the same as the name of the class
d. The class definition contains prototype statements for the methods
e. All of the statements (a-d) are true. - ✔✔e. All of the statements (a-d) are
true.
If a string will need room for 25 characters, how should it be defined so that
it will be a valid string?
a. char str[25];
b. char str[24];
c. char str[26];
d. char str[]; - ✔✔c. char str[26];
2
©JOSHCLAY 2024/2025. YEAR PUBLISHED 2024.
, Which of the following string functions will ALWAYS produce a valid string
after execution?
a. strcpy
b. strcat
c. Both of the functions (a-b) will produce a valid string - ✔✔c. Both of the
functions (a-b) will produce a valid string
The null terminator is __________.
a. used to advance to a new line when executing a cout statement
b. represented as '\0'
c. used to end a valid string
d. a movie starring Arnold Schwarzenegger
e. All of the statements (a-d) are correct
f. Only statements b and c are correct - ✔✔f. Only statements b and c are
correct.
Which of the following is the correct definition for a variable called dblRef
that can hold a reference to the double variable dblNum?
a. double dblRef = dblNum;
3
©JOSHCLAY 2024/2025. YEAR PUBLISHED 2024.