Question: QUESTION 1 Input/Output in C++ occurs as streams of bytes True False QUESTION 2 Most C++ programs that do I/O should include the: A. Input
QUESTION 1
Input/Output in C++ occurs as streams of bytes
True
False
QUESTION 2
Most C++ programs that do I/O should include the:
| A. | Input header that contains the declarations required for all stream input operations | |
| B. | | |
| C. | output header that contains the declarations required for all stream output operations | |
| D. | |
QUESTION 3
What 's the correct statement to print the integer value of a 'c'
| A. | cout << 'c'; | |
| B. | cout<< 'c' endl; | |
| C. | cout<< static_cast < int> ('c'); | |
| D. | cout<< int 'c'; |
QUESTION 4
The size, shape, color and wight of an object are considered attributes of the object's class.
True
False
QUESTION 5
C++ is a procedural programming language just like COBOL
True
False
QUESTION 6
The followings are all steps in the programming process
| A. | The purpose of the program, Visualize the program, email the program | |
| B. | Correct errors, use braces {}, use Visual Studio IDE, zip your program | |
| C. | write pseudocode, validate the result, compile your program, use C++ | |
| D. | Type the code, Save your program, compile your program, validate the result |
QUESTION 7
Logical operators are used to create:
| A. | functions from other functions | |
| B. | relational expressions from other relational expressions | |
| C. | conditions from other conditions | |
| D. | assignment operators |
QUESTION 8
A function must know the following about a function before it is called:
| A. | name, string type, number of variables, data type of each variable | |
| B. | return type, main(), number of variables, data type of each variable | |
| C. | number of parameters, integer type, number of variables, return type | |
| D. | name, return type, number of parameters, data type of each parameter |
QUESTION 9
Which of the following is a valid C++ array definition?
| A. | int array[0]; | |
| B. | float $payments[10]; | |
| C. | void numbers[5]; | |
| D. | int array[10]; | |
| E. | None of the above |
QUESTION 10
Given the following function definition:
void calc (int a, int& b)
{
int c;
c = a + 2;
a = a * 3;
b = c + a;
}
What is the output of the following code fragment that invokes calc?
(All variables are of type int)
x = 10;
y = 20;
z = 30;
calc(x, y);
cout << x << " " << y << " " << z << endl;
| A. | 1 2 3 | |
| B. | 10 60 30 | |
| C. | 3 6 3 | |
| D. | 1 14 9 |
QUESTION 11
A good reason for overloading an operator is to enable it to:
| outperform its C language counterparts | ||
| work in its usual way, but with programmer-defined data types | ||
| operate on more operands than in its standard definition | ||
| operate on no operands |
QUESTION 12
Class members specified as public are accessible only to member functions of the class and friends of the class.
True
False
QUESTION 13
The asterisk ( * ), also known as the address operator, returns the memory address of a variable.
True
False
QUESTION 14
This type of member variable may be accessed before any objects of the class have been created.
| A. | private | |
| B. | public | |
| C. | inline | |
| D. | static |
QUESTION 15
C++ requires that a copy constructor's parameter be a(n)
| A. | integer data type | |
| B. | floating point data type | |
| C. | pointer variable | |
| D. | reference object |
QUESTION 16
In OOP terminology, an object's member variables are often called its _________, and its member functions are sometimes referred to as its behaviors, or ____________.
| A. | values, morals | |
| B. | data, activities | |
| C. | attributes, activities | |
| D. | attributes, methods |
QUESTION 17
This is used to protect important data. .
| A. | public access specifier | |
| B. | private access specifier | |
| C. | protect() member function | |
| D. | class protection operator, @ |
QUESTION 18
Objects are created from abstract data types that encapsulate _______ and _______ together.
| A. | numbers, characters | |
| B. | data, functions | |
| C. | addresses, pointers | |
| D. | integers, floats |
QUESTION 19
When the body of a member function is defined inside a class declaration, it is said to be
| A. | static | |
| B. | globally | |
| C. | inline | |
| D. | conditionally |
QUESTION 20
For the following code, which statement is not true?
class Point
{
private:
double y;
double z;
public:
double x;
};
| A. | x is available to code that is written outside the class. | |
| B. | The name of the class is Point | |
| C. | x, y, and z are called members of the class. | |
| D. | z is available to code that is written outside the class. |
QUESTION 21
What is the output of the following program?
#include
using namespace std;
class TestClass
{
public:
TestClass(int x)
{ cout << x << endl; }
TestClass()
{ cout << "Hello!" << endl; }
};
int main()
{
TestClass test;
return 0;
}
| A. | The program runs, but with no output. | |
| B. | Hello! | |
| C. | 0 | |
| D. | The program will not compile. |
QUESTION 22
Which of the followings allows us to create a new classes based on existing classes
| A. | Polymorphism | |
| B. | Inheritance | |
| C. | Function overloading | |
| D. | The copy constructor |
QUESTION 23
Which term means the ability to take many forms
| inheritance | ||
| polymorphism | ||
| member function | ||
| encapsulation |
QUESTION 24
When a derived class has two or more base classes, the situation is known as:
| multiple inheritance | ||
| polymorphism | ||
| encapuslation | ||
| access specification |
QUESTION 25
In the following statement
class car : protected Vehicle
Which is the derived class?
| A. | Car | |
| B. | Vehicle | |
| C. | protected | |
| D. | cannot be determined |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
