100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

Chapter 5 Data Structures Exam Questions with Answers

Puntuación
-
Vendido
-
Páginas
9
Grado
A+
Subido en
12-04-2025
Escrito en
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

Mostrar más Leer menos
Institución
Data Structures And Algorithm Analysis In C+
Grado
Data Structures and Algorithm Analysis in C+









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Data Structures and Algorithm Analysis in C+
Grado
Data Structures and Algorithm Analysis in C+

Información del documento

Subido en
12 de abril de 2025
Número de páginas
9
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

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;
$16.99
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
EXAMSTUVIA

Documento también disponible en un lote

Conoce al vendedor

Seller avatar
EXAMSTUVIA stuvia
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
2
Miembro desde
1 año
Número de seguidores
2
Documentos
1102
Última venta
3 meses hace
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!!!!!!!!!!!!

Lee mas Leer menos
0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes