Questao 1-20 cpp

Questao 1-20 cpp

Questao 1-20 para a prova de cpp da facul

Imagem de perfil user: Guilherme Carvalheira

Anúncios

1

1 True/False A class declaration creates an object.

True
False
2

True/False: A constructor is a public class function that is automatically invoked(i.e..called) whenever a class object is created

False
True
3

True/False: A class must have exactly one constructor.

True
False
4

A local variable and a global variable may not have the same name within a program.

True
False
5

A function return data type must be the same as the function parameters.

False
True
6

You must always furnish an argument with a function call.

True
False
7

If a member variable is declared -------. all objects of that class share access to that variable.

default
inline
none of these
dynamic
Static
8

Object composition is useful for creating a ------- relationship between classes.

has-a
friend
conditional
none of these
static
9

True/False: A static member function can be called independently of any object of the class.

False
True
10

True/False: By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.

True
False
11

The process of having a class contain an instance of another class is knows as

object composition
object overloading.
dynamic composition
none of these
operator overloading
12

an array can store multiple values, but the values must be

numeric, not characters or strings.
all the same data type
none of these
declared at the time the array is created.
constants.
13

Subscript numbering in C++

automatically begin with one.
varies from program to program.
can begin with a programmer-defined value.
can be set at run time.
automatically begins with zero.
14

True/False: Each individual element of an array can be accessed by the array name and an element number, called a subscript.

True
False
15

True/False: An individual array element can be processed or passed to a function just like a regular C++ variable.

False
True
16

An array can be returned by a function as well as passed to a function

False
True
17

If the score array is defined like this: int scores [ ]= {4, 7, 4, 8, 9,}; what will the following statement display? cout << scores[4];

7
9
8
4
the first four scores
18

To add up all the values in a two-dimensional array it would be best to use

two separate for loops
no loop
one sentinel controlled loop
one for loop
a nested for loop
19

True/False: In C++ if you attempt to store more data in an array than it can hold, the compiler will issue an error.

False
True
20

On each iteration of the following Range-based for loop for (int element : myArray) cout<< element << endl; the variable element holds

an array name
an array subscript.
an array value
an array location
none of these
Quizur Logo

Siga nossas redes sociais:

Incorporar

Para incorporar este quiz ao seu site copie e cole o código abaixo.