Quiz
Week06 Quiz1
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (16)
1A pointer variable is designed to store
- Aany legal C++ value.
- Bonly floating-point values.
- Ca memory address.
- Dan integer.
- ENone of these
2Dynamic memory allocation occurs
- Awhen a new variable is created by the compiler
- Bwhen a new variable is created at runtime
- Cwhen a pointer fails to dereference the right variable
- Dwhen a pointer is assigned an incorrect address
- ENone of these
3When the less than ( < ) operator is used between two pointer variables, the expression is testing whether
- Athe value pointed to by the first is less than the value pointed to by the second
- Bthe value pointed to by the first is greater than the value pointed to by the second
- C the address of the first variable comes before the address of the second variable in the computer's
memory - Dthe first variable was declared before the second variable
- ENone of these
4Look at the following statement.
int *ptr;
In this statement, what does the word int mean?- Athe variable named *ptr will store an integer value
- Bthe variable named *ptr will store an asterisk and an integer value
- Cptr is a pointer variable that will store the address of an integer variable
- DAll of these
- ENone of these
5The contents of pointer variables may be changed with mathematical statements that perform:
- Aall mathematical operations that are legal in C++
- Bmultiplication and division
- Caddition and subtraction
- Db and c
- ENone of these
6The _________ , also known as the address operator, returns the memory address of a variable.
- Aasterisk ( * )
- Bampersand ( & )
- Cpercent sign (%)
- Dexclamation point ( ! )
- ENone of these
7The statement cin >> *num3;
- Astores the keyboard input into the variable num3.
- Bstores the keyboard input into the pointer called num3.
- Cis illegal in C++.
- Dstores the keyboard input into the variable pointed to by num3.
- ENone of these.
8What will the following statement output?
cout << &num1;- AThe value stored in the variable called num1.
- BThe memory address of the variable called num1.
- CThe number 1.
- DThe string "&num1".
- ENone of these
9Which of the following statements is not valid C++ code?
- Aint ptr = &num1;
- Bint ptr = int *num1;
- Cfloat num1 = &ptr2;
- DAll of these are valid
- EAll of these are invalid.
10The statement
int *ptr = new int;- Aresults in a compiler error.
- Bassigns an integer less than 32767 to the variable named ptr.
- Cassigns an address to the variable named ptr.
- Dcreates a new pointer named int.
- ENone of these
11These can be used as pointers.
- AArray names
- BNumeric constants
- CPunctuation marks
- DAll of these
- ENone of these
12Look at the following statement:
sum = *array++;
This statement...- Ais illegal in C++
- Bwill always result in a compiler error
- Cassigns the dereferenced pointer's value, then increments the pointer's address
- Dincrements the dereferenced pointer's value by one, then assigns that value
- E
None of these
13When this is placed in front of a variable name, it returns the address of that variable.
- Aasterisk ( * )
- Bconditional operator
- Campersand ( & )
- Dsemicolon ( ; )
- ENone of these
14Use the delete operator only on pointers that were
- Anever used
- Bnot correctly initialized
- Ccreated with the new operator
- Ddereferenced inappropriately
- ENone of these
15The following statement has the same meaning as ____.
int *ptr;- Aint ptr;
- B*int ptr;
- Cint ptr*;
- Dint* ptr;
- ENone of these
16A function may return a pointer, but the programmer must ensure that the pointer
- A still points to a valid object after the function ends
- Bhas not been assigned an address
- Cwas received as a parameter by the function
- Dhas not previously been returned by another function
- ENone of these
Informações
- Descrição
- Quiz sobre Week06 Quiz1, criado por Eric White em 06-08-2015.
- Autor
- Eric White
- Idioma
- English
- Visualizações
- 1
- Avaliação
- Ainda sem avaliações Avalie este quiz