100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

Quiz 4

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
14-01-2021
Written in
2020/2021

Exam of 5 pages for the course Data Structures at Comsats Institute Of Information And Technology (Quiz)

Institution
Course

Content preview

EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II



Quiz 4 Solutions
Q1: What value does function mystery return when called with a value of 4?

int mystery ( int number )
{
if ( number <= 1 )
return 1;
else
return number * mystery( number – 1 );
}

a. 0.
b. 1.
c. 4.
d. 24.
ANS: d. 24.



Q2: Recursion is memory-intensive because:
a. Recursive functions tend to declare many local variables.
b. Previous function calls are still open when the function calls itself and the activation records of these
previous calls still occupy space on the call stack.
c. Many copies of the function code are created.
d. It requires large data values.
ANS: b. Previous function calls are still open when the function calls itself and the activation records of these
previous calls still occupy space on the call stack.



Q3: Linear search is highly inefficient compared to binary search when dealing with:
a. Small, unsorted arrays.
b. Small, sorted arrays.
c. Large, unsorted arrays.
d. Large, sorted arrays.
ANS: d. Large, sorted arrays.



Q4: A double subscripted array declared as int a[ 3 ][ 5 ]; has how many elements?
a. 15
b. 13
c. 10
d. 8
ANS: a. 15




1|Quiz 4 Solutions

, EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II


Q5: Using square brackets ([]) to retrieve vector elements __________ perform bounds checking;
using member function at to retrieve vector elements __________ perform bounds checking.
a. Does not, does not.
b. Does not, does.
c. Does, does not.
d. Does, does.
ANS: b. Does not, does.



Q6: Which file open mode would be used to write data only to the end of an existing file?
a. ios::app
b. ios::in
c. ios::out
d. ios::trunc
ANS a. ios::app



Q7: A random access file is organized most like a(n):
a. Array.
b. Object.
c. Class.
d. Pointer.
ANS: a. Array.



Q8: To write fixed-length records, use file open mode:
a. ios::app
b. ios::ate
c. ios::trunc
d. ios::binary
ANS: d. ios::binary



Q9: The total number of elements that can be stored in a string without increasing its current amount of allocated
memory is called its:
a. Size.
b. Length.
c. Capacity.
d. Maximum size.
ANS: c. Capacity.



Q10: An algorithm that requires __________ operations to complete its task on n data elements is said to have a
linear runtime.
3
a. n + 9
2
b. 3 n + 3 n + 2
c. 2 n + 1
d. 6
ANS c. 2 n + 1




2|Quiz 4 Solutions

Written for

Institution
Course

Document information

Uploaded on
January 14, 2021
Number of pages
5
Written in
2020/2021
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$7.99
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
youtubecanvas

Get to know the seller

Seller avatar
youtubecanvas COMSATS Institute Of Information Technology
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
5 year
Number of followers
0
Documents
18
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions