Exam 1: Quiz Solutions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the value of the global variable comparisons for sorting the input vector v1{1,2,3,4,5,6,7,8,9,10}?

45

What is the value of the global variable comparisons for sorting the input vector v{10,9,8,7,6,5,4,3,2,1}?

45

What is the value of the global variable comparisons for sorting the vector v1 of size n?

(n-1)n/2

int* ip = new int[3]{1,2,3}; cout << (*ip)++; What value is displayed by the cout statement?

1

int* ip = new int[3]{1,2,3}; cout << *(ip++); What value is displayed by the cout statement?

1

int* ip = new int[3]{1,2,3}; cout << *(++ip); What value is displayed by the cout statement?

2

int* ip = new int[3]{1,2,3}; cout << ++(*ip); What value is displayed by the cout statement?

2

Can the algorithm recognize a sorted input? (True = Yes, False = No)

F

The amortized cost of inserting a new item into a dynamic array is more efficient when the incremental strategy is used rather than the doubling strategy. (T/F)

F

The algorithm presented in the video acts in the same way as

Selection sort

A dynamic array allocated on a heap/free memory can change its size during the runtime of a program. (T/F)

T

An element of a dynamic array allocated on a heap/free memory can be accessed explicitly using the name of the array and the bracket operator [ ]. (T/F)

T

The Abstract Data Type (ADT) defines a theoretical model of a data structure. (T/F)

T

To avoid shallow copy of a class object a user-defined copy constructor should be provided even if any data member is not a pointer. (T/F)

T

int* ip = new int(5); cout << *ip; What is the type of the variable ip?

pointer to type int

int* ip = new int(5); cout << *ip; Where does the variable ip reside in computer memory?

stack part


Set pelajaran terkait

ACCT221 CH.3 HW EXERCISE 138 (Principals & Assumptions)

View Set

Algebra II Mid Term Exam Study Guide

View Set

Unit 4: Close Analysis of Poetic Form and Content

View Set

Introduction to Instruction and Presentation

View Set

Cognitive Final Chapters: 11 and onward

View Set