Subject / 421 questions

Programming MCQs

Page 5 of Programming multiple-choice questions with answers. Tap an option to check yourself.

Page 5 of 22

Advertisement
Question 86 Data Structures

Why does a dynamic array such as C++ std::vector achieve amortised O(1) time for appending elements?

Correct answer C. It grows its capacity geometrically, so expensive reallocations happen rarely

Open question
Advertisement
Question 94 DBMS and SQL

Why must a secondary index, built on a key that is not the file’s sort order, be a dense index?

Correct answer C. Because the records are not sorted on that key, so every key value needs its own index entry

Open question
Advertisement