Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Quiz 4

Beoordeling
-
Verkocht
-
Pagina's
5
Cijfer
A+
Geüpload op
14-01-2021
Geschreven in
2020/2021

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

Instelling
Vak

Voorbeeld van de inhoud

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

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
14 januari 2021
Aantal pagina's
5
Geschreven in
2020/2021
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$7.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
youtubecanvas

Maak kennis met de verkoper

Seller avatar
youtubecanvas COMSATS Institute Of Information Technology
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
5 jaar
Aantal volgers
0
Documenten
18
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen