100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Chapter 5 Data Structures Exam Questions with Answers

Beoordeling
-
Verkocht
-
Pagina's
9
Cijfer
A+
Geüpload op
12-04-2025
Geschreven in
2024/2025

Chapter 5 Data Structures Exam Questions with Answers linked list - Correct Answers: A sequence of items arranged one after another, with each item connected to the next by a link is called a(n) head pointer - Correct Answers: A pointer to the first node in a linked list is called the tail pointer - Correct Answers: A pointer to the last node in a linked list is called the an empty list - Correct Answers: A linked list that contains no nodes is called what? null pointer - Correct Answers: A special C++ constant used for any pointer value that has no place to point is called a nodes - Correct Answers: A collection of _______ makes up a linked list. (*p).m - Correct Answers: If p is a pointer to a class, and m is a member of the class, then p->m means the same as A. (*p).m B. *p.m C. (p.)m D. (*p.)m E. p.m node - Correct Answers: What is the data type of *head_ptr in Figure 5.3 on page 224? A. node B. pointer to a node C. value_type D. data_field pointer to node - Correct Answers: What is the data type of head_ptr in Figure 5.3 on page 224? A. pointer to a node B. node C. value_type D. data_field - Correct Answers: What is the data type of head_ptr->data( ) in Figure 5.3 on page 224? (The definition of data( ) is on page 226.) A. data_field B. pointer to a node C. node D. value_type - Correct Answers: What will the following function return? int calculate(const node* head_ptr) { const node *ptr; int n = 0; for (ptr = head_ptr->get_next(), ptr != NULL; ptr = ptr->get_next()) n++; return n; } A. the length of the list plus 1 B. the length of the list plus 2 C. the length of the list minus 2 D. the length of the list E. the length of the list minus 1 the beginning of the linked list - Correct Answers: The two lines of code below will insert a new node into a linked list at which location? node *ptr = new node(x, head_ptr); head_ptr = ptr; A. after the node pointed to by head_ptr B. the end of the linked list C. the beginning of the linked list D. after the node pointed to by ptr - Correct Answers: The two lines of code below will insert a new node into a linked list at which location? node *ptr = new node(x, previous_ptr->get_next()); previous_ptr->set_next(ptr); A. before the node pointed to by previous_ptr B. after the node pointed to by previous_ptr C. after the node pointed to by ptr D. after the node pointed to by previous_ptr->get_next() E. the end of the linked list a pointer to the node containing the value of x or the NULL pointer - Correct Answers: What does the following function return? node* list_search(node *head_ptr, double x) { node *ptr; for (ptr = head_ptr; ptr != NULL; ptr = ptr->get_next()) if (x == ptr->get_value()) return ptr; return NULL; } A. the value of x B. TRUE or FALSE C. the position in the linked list of the node containing the value of x D. a pointer to the node containing the value of x or the NULL pointer deletes the first node in the linked list - Correct Answers: What action does the following code segment perform? node *ptr = head_ptr; head_ptr = head_ptr->get_next(); delete ptr; A. deletes the node pointed to by head_ptr->get_next( ) B. deletes the first node in the linked list C. deletes the node that comes immediately after the node pointed to by head_ptr D. deletes the last node in the linked list deletes the node that comes after the node initially pointed to by previous_ptr - Correct Answers: What action does the following code segment perform? node *ptr = previous_ptr->get_next(); previous_ptr->set_next(ptr->get_next()); delete ptr; A. deletes the node initially pointed to by previous_ptr B. deletes the node that comes before the node initially pointed to by previous_ptr C. deletes the node that comes after the node initially pointed to by previous_ptr 12 - Correct Answers: For the linked list shown below, what will the code segment display? Head_ptr -> 4 -> 6 -> 12, NULL node *ptr = head_ptr->get_next( ); ptr = ptr->get_next( ); cout << ptr->get_value( ); A. 6 B. 4 C. nothing D. 12 10 - Correct Answers: For the linked list shown below, what will the code segment display? Head_ptr -> 4 -> 6 -> 12 -> 20, NULL node *ptr; int sum = 0; for (ptr = head_ptr; ptr->get_value( ) < 10; ptr = ptr->get_next( )) sum += ptr->get_value( ); cout << sum << endl; A. 42 B. 6 C. 10 D. 4 E. 22 32 - Correct Answers: For the linked list shown below, what will the code segment display? Head_ptr -> 4 -> 6 -> 12 -> 20,NULL node *ptr1, *ptr2; ptr1 = head_ptr; ptr2 = ptr1; ptr2 = ptr2->get_next( ); ptr2 = ptr2->get_next( ); ptr1 = ptr2->get_next( ); cout << ptr1->get_value( ) + ptr2->get_value( ) << endl; A. 10 B. 32 C. 24 D. 18 E. 26 - Correct Answers: For the linked list shown below, what will the code segment display? Head_ptr -> 4 -> 6 -> 12,NULL node *ptr; for (ptr = head_ptr->get_next( ); ptr != NULL; ptr = ptr->get_next( )) cout << ptr->get_data( ); A. 46 B. 46120 C. 612 D. 4612 E. nothing

Meer zien Lees minder
Instelling
Data Structures And Algorithm Analysis In C+
Vak
Data Structures and Algorithm Analysis in C+









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Data Structures and Algorithm Analysis in C+
Vak
Data Structures and Algorithm Analysis in C+

Documentinformatie

Geüpload op
12 april 2025
Aantal pagina's
9
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

Chapter 5 Data Structures
Exam Questions with Answers
linked list - Correct Answers: A sequence of items arranged one after another, with each item connected
to the next by a link is called a(n)



head pointer - Correct Answers: A pointer to the first node in a linked list is called the



tail pointer - Correct Answers: A pointer to the last node in a linked list is called the



an empty list - Correct Answers: A linked list that contains no nodes is called what?



null pointer - Correct Answers: A special C++ constant used for any pointer value that has no place to
point is called a



nodes - Correct Answers: A collection of _______ makes up a linked list.



(*p).m - Correct Answers: If p is a pointer to a class, and m is a member of the class, then p->m means
the same as



A. (*p).m

B. *p.m

C. (p.)m

D. (*p.)m

E. p.m



node - Correct Answers: What is the data type of *head_ptr in Figure 5.3 on page 224?



A. node

, B. pointer to a node

C. value_type

D. data_field



pointer to node - Correct Answers: What is the data type of head_ptr in Figure 5.3 on page 224?



A. pointer to a node

B. node

C. value_type

D. data_field



- Correct Answers: What is the data type of head_ptr->data( ) in Figure 5.3 on page 224? (The definition
of data( ) is on page 226.)



A. data_field

B. pointer to a node

C. node

D. value_type



- Correct Answers: What will the following function return?



int calculate(const node* head_ptr)



{



const node *ptr;



int n = 0;
$17.49
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Lees online óf als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
EXAMSTUVIA

Ook beschikbaar in voordeelbundel

Thumbnail
Voordeelbundel
Data Structures and Algorithm Analysis Bundle Compilation Grade A+
-
15 2025
$ 262.05 Meer info

Maak kennis met de verkoper

Seller avatar
EXAMSTUVIA stuvia
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
2
Lid sinds
1 jaar
Aantal volgers
2
Documenten
1175
Laatst verkocht
5 maanden geleden
Stuvia Exam

Assignments, Case Studies, Research, Essay writing service, Questions and Answers, Discussions etc. for students who want to see results twice as fast. I have done papers of various topics and complexities. I am punctual and always submit work on-deadline. I write engaging and informative content on all subjects. Send me your research papers, case studies, psychology papers, etc, and I’ll do them to the best of my abilities. Writing is my passion when it comes to academic work. I’ve got a good sense of structure and enjoy finding interesting ways to deliver information in any given paper. I love impressing clients with my work, and I am very punctual about deadlines. Send me your assignment and I’ll take it to the next level. I strive for my content to be of the highest quality. Your wishes come first— send me your requirements and I’ll make a piece of work with fresh ideas, consistent structure, and following the academic formatting rules. For every student you refer to me with an order that is completed and paid transparently, I will do one assignment for you, free of charge!!!!!!!!!!!!

Lees meer Lees minder
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

Veelgestelde vragen