Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ PROGRAMMING Question 1 A one-dimensional array is a list of related values with the same ____ that is stored using a single group name.

C++ PROGRAMMING

Question 1

A one-dimensional array is a list of related values with the same ____ that is stored using a single group name.

size

data type

value

offset

Question 2

Consider the declarations const int ARRAYSIZE = 7; and double length[ARRAYSIZE] = {7.8, 6.4, 4.9, 11.2};. How many elements will be initialized to zero?

none

one

two

three

Question 3

The statement cin >> grade[4] >> prices[6]; causes ____ values to be read and stored.

2

4

6

10

Question 4

Passing addresses is referred to as a function pass by reference because the called function can reference, or access, the variable whose address has been passed.

True

False

Question 5

A called function can return more than one legitimate value to its calling function.

True

False

Question 6

The new and delete operators provide a mechanism for enlarging and shrinking arrays.

Answers:

True

False

Question 7

Under a dynamic allocation scheme, the amount of storage to be allocated is determined and adjusted ____.

Answers:

at compile time

at runtime

when a program error occurs

interactively by the user

Question 8

For dynamic allocation of memory to create new variables as a program is running, pointers are ____.

Answers:

required

helpful

not allowed

allowed

Question 9

Adding 1 to a pointer causes the pointer to point to the ____.

Answers:

next element of the type pointed to

first element of the type pointed to

next byte

next block

Question 10

The expression *gPtr + 3 is equivalent to *(gPtr + 3).

Answers:

True

False

Question 11

Any subscript used by a programmer is automatically converted to a(n) ____ by the compiler.

Answers:

integer

expression

offset

equivalent pointer expression

QUESTION 12

What is the output of the following C++ code?

int *p = new int;

int *q = new int;

p = q;

*q = 75;

delete p;

p = new int;

*p = 26;

q = new int;

q = p;

*q = 62;

cout << *p << " " << *q << endl;

Selected Answer:

62 62

Question 13

A class ____ automatically executes whenever a class object goes out of scope.

Selected Answer:

destructor

Answers:

constructor

destructor

pointer

exception

Question 14

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.

Selected Answer:

True

Answers:

True

False

Question 15

1 out of 1 points

If a is a class object and p, a pointer, is a public member of the class, what will the following statement do?

cout << *a.p;

Answers:

Output the dereferenced value pointed to by p

Result in a compiler error

Output the address stored in p

Output the value stored in a

Question 16

Which of the following is true about classes and structs?

Selected Answer:

You cannot use the member access specifier private in a struct.

Answers:

By default, all members of a struct are public and all members of a class are private.

A struct variable is passed by value only, and a class variable is passed by reference only.

An assignment operator is allowed on class variables, but not on struct variables.

You cannot use the member access specifier private in a struct.

Question 17

What will the following code display?

int numbers[] = { 99, 87, 66, 55, 101 };

for (int i = 1; i < 4; i++)

cout << numbers[i] << " ";

Answers:

99 87 66 55 101

87 66 55 101

87 66 55

Nothing. This code has an error.

Question 18

Given the declaration Student *student;, the statement student = new Student[50]; dynamically allocates a dynamic array of the type ____.

Answers:

Student

student

pointer

Student*

Question 19

Which is Abstract Data Type in C++

Answers:

Class

int

float

array

Question 20

By default functions available in C++ language are

Answers:

Constructor

Copy Constructor

Destructor

Assignment Operator

All of above

Question 21

What is the output of this program?

1. #include  
2. using namespace std; 
3. int main () 
4. { 
5. int numbers[5]; 
6. int * p; 
7. p = numbers; *p = 10; 
8. p++; *p = 20; 
9. p = &numbers[2]; *p = 30; 
10. p = numbers + 3; *p = 40; 
11. p = numbers; *(p + 4) = (*p) *2; 
12. for (int n = 0; n < 5; n++) 
13. cout << numbers[n] << ","; 
14. return 0; 
15. } 

Answers:

10,20,30,40,20,

10,20,30,40,40,

Compiler Error

Runtime Error

Question 22

A linked list is a random access data structure such as an array.

Answers:

True

False

Question 23

Because initially the list is empty, the pointer listData must be initialized to ____.

Answers:

NULL

EMPTY

NIL

NOP

Question 24

In a linked list, we always want listData to point to the ____ node.

Answers:

key

main

first

last

Question 25

To access the fifth element in a list, we must first traverse the first four elements.

Answers:

True

False

Question 26

To delete a given item from an ordered linked list, there is no need to search the list to see whether the item to be deleted is in the list.

Answers:

True

False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

discuss the four components of effective leadership.

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago