Exam 4, 1300.

Ace your homework & exams now with Quizwiz!

Before a structure can be used, it must be _______________ a. declared b. dereferenced c. initialized d. constructed

A. Declared

Data types that are created by the programmer are known as ______________ a. Variables b. Abstract data types (ADT) c. Functions d. Parameters

B:Abstract Data types (ADT)

Every byte in the computer's memory is assigned a unique ______________________ a. pointer b. address c. name d. dynamic allocator

B:Address

Dynamic memory allocation occurs when _______________ a. a new variable is created by the compiler b. a pointer fails to dereference the right variable c. a new variable is created at runtime d. a pointer is assigned an incorrect address

C: A new variable is created at runtime

Relational operators allow you to ______________ numbers a. add b. multiply c. compare d. average

C: compare

You may use a pointer to a structure as a _______________ a. Function parameter b. Structure member c. Function return type d. All of these

D: All of the Above

This is required after the closing brace of the structure definition: a. Curly bracket b. Square bracket c. Period d. Semicolon

D: Semicolon

Assuming the user enters a 90 to the keyboard, what will the following code output? cout << "Enter a test score"; cin >> testScore; if (testScore < 60); cout << "You failed the test" << endl; if (testScore > 60) cout << "You passed the test" << endl; else cout << "You need to study for the next test!" << endl; a. You failed the test b. You passed the test c. You failed the test You need to study for the next test! d. You failed the test You passed the test

D: you failed the test you passed the test

A struct can contain members with varying data types a. True b. False

True

C++ does not perform array bounds checking, making it possible for you to assign a pointer the address of an element out of the boundaries of an array a. True b. False

True

If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type a. True b. False

True

The ampersand is used to dereference a pointer variable in C++ a. True b. False

True

The ________________, also known as the address operator, returns the memory address of a variable a. asterisk b. ampersand c. percent sign d. exclamation point

b. ampersand

A function __________________ return a structure a. will always b. may c. may not d. cannot possibly

b. may

When you work with a dereferenced pointer, you are actually working with _________________ a. a variable whose memory has been allocated b. a copy of the value pointed to by the pointer variable c. the actual value of the variable whose address is stored in the pointer variable d. all of the above

c. the actual value of the variable whose address is stored in the pointer variable

To dereference a structure pointer, the appropriate operator is _________________ a. the ampersand, & b. an asterisk, * c. the structure pointer operator, -> d. the dereference operator, <-

c. the structure pointer operator, ->

Look at the following statement booklist[2].publisher[3] ='t'; This statement... a. Is illegal in C++ b. Will change the publisher's name of the second book in booklist to 't' c. Will store the character 't' in the fourth element of the publisher member of booklist[2] d. Will ultimately result in a runtime error

c: Will store the character 't' in the fourth element of the publisher member of booklist[2]

If Circle is a structure, the statement Circle* pcirc = nullptr; a. is illegal in C++ b.initializes a null pointer with the value of the Circle pointer c. declares an empty structure variable called *pcirc d. declares a structure pointer called pcirc initialized with a null pointer

d. declares a structure pointer called pcirc initialized with a null pointer


Related study sets

Legal Environment of Business Contracts

View Set

143 Module 2 - Lower Respiratory Tract Disorders (PRACTICE QUESTIONS)

View Set

Nclex questions for Fundamentals of Nursing with rationale

View Set

Lec 14 Sensory (2)✓mechanorecep (hearing + balance)

View Set

Researching Consumer Food Preferences: AGEC/FDSC 4243 Exam 1

View Set