0% found this document useful (0 votes)
25 views8 pages

Act 9 - Quiz 2-DataStructure

The document presents a questionnaire of 17 questions about linear data structures such as stacks and queues. The questions evaluate concepts such as the implementation of stacks and queues using linked lists, basic operations like inserting and deleting elements, and the difference between stacks and queues.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views8 pages

Act 9 - Quiz 2-DataStructure

The document presents a questionnaire of 17 questions about linear data structures such as stacks and queues. The questions evaluate concepts such as the implementation of stacks and queues using linked lists, basic operations like inserting and deleting elements, and the difference between stacks and queues.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Act 9: Quiz 2

Question 1
Points: 1

A queue data structure can be implemented using arrays or linked lists. Next
the structure used to implement a queue through a linked list is presented in which
vehicle license plates are stored:

struct queue

char plate[6];

struct queue sig;

} *CAB=NULL,*P, *Q;

Identify what the problem is in the definition of the structure:

Select an answer.
a. The plate should be divided into a letter part and a numeric part
b. The CAB pointer can never be initialized to NULL.
c. Error in the definition of the pointer that links to the next element of the
list
d. The pointers CAB, P, and Q are unnecessary as they are never used

Question 2
Points: 1

The question you will find below consists of a statement and a reason connected by
the word BECAUSE. You must judge both the degree of truth or falsehood of each one of
they as the existing relationship between them.

__________________

In the implementation of dynamic linear structures of the queue type, a pointer of the same type is used.
structure that is used as a link to the next element of the queue, just like a linked list
Because a pointer is a variable that stores the address of another variable in its content.
Furthermore, pointer-type variables are used for the implementation of structures.
dynamics because they can be created and released at runtime.

Select an answer.
a. The statement and the reason are TRUE, but the reason is NOT one
CORRECT explanation of the statement.
b. The statement and the reason are TRUE and the reason is an explanation
Correct of the statement.
c. The statement is FALSE, but the reason is a TRUE proposition.
d. The statement is TRUE, but the reason is a FALSE proposition.

Question 3
Points: 1
The following function is part of the implementation of a queue:

void insert(void)

AUX=(struct queue *)malloc(sizeof(struct queue));

clrscr();

cout << "data: ";

gets(AUX->data);

AUX->sig=NULL;

if (FINAL==NULL)

HEAD

else

FINAL->sig=AUX;

AUX

This function allows:

Select an answer.
a. Extract an element from a queue
b. Add element to an empty or non-empty queue
c. Visualize the elements of a queue
d. Modify the elements of a queue

Question 4
Points: 1
Analyze the following code, perform a desk test and determine among the options of
response, the value that the three variables (*x, **y, a) take at the end of the program in its
output on screen.

void main(){
int a=10,*x,**y;
x = &a;
*x = 20;
y = &x ;
y += *x;
The value of a is:
The value of *x is:
cout <<" The value of **y is:" << **y;
Invalid input, unable to translate.
Select an answer.
a. The variable a shows the value 10, the variable *x and the variable **y show only
they show memory addresses
b. The three variables show the value of 40
c. The variable a shows the value 10, the variable *x and the variable **y show the value
of 20
d. The three variables show a value of 30

Question 5
Points: 1
The following source code fragment corresponds to a part of the implementation of
a stack, Knowing that the variables start and c are pointers, and start is a member of the
structure; determine which of the following options is the operation performed by the following
function.

void Function (void)


{
inicio=(struct stack *)malloc(sizeof(struct stack));
clrscr(); cout<<"Enter the INTEGER type data: ");
cin >> inicio->numero;
if (c==NULL) { c=start;
sig=NULL;
}
else
{
start->next=c;
c=start;
}
}

Select an answer.
a. Visualize stack data
b. Insert data into the stack
c. Traverse the stack
d. Remove data from the stack

Question 6
Points: 1
Select from the following options the one that does NOT correspond to the operations that
They can usually be done with batteries.
Select an answer.
a. Remove the last element inserted into the stack
b. Insert an element at the end of the stack
c. Search for an element in the stack
d. Remove an element from the middle of the stack

Question 7
Points: 1
Linear data structures of type Stack can be represented in memory by means of:
Select an answer.
a. Arrays
b. Linked Lists
c. Arrays and doubly linked lists
d. Arrays and Linked Lists

Question 8
Points: 1
Queues are part of linear data structures, they are also known as
FIFO lists, similarly, are identified as a linear list conditioned likewise.
That the stacks, the difference between them lies in the way of inserting and deleting their elements.
since in a queue, insertions and deletions are performed in the following manner.

Select at least one answer.


a. The dequeues from the queue are performed at the beginning of the list (from the front) it is
the first to enter is the first to leave
b. The removals from a non-empty queue are done from the top (at the end) that is,
last in, first out
c. Insertions are made at the top (at the end of the queue), that is, by the same.
extreme of the eliminations
d. Insertions of a non-empty queue are made at the end of the list

Question 9
Points: 1
The following code snippet refers to a function used in the
implementation of a stack data structure.

void function(void) {

first=(struct stack *)malloc(sizeof(struct stack));

cout << "Enter Computer or Team Name:";

cin >> first->team;

if(x==NULL)

x=first;

first->next=NULL;

else

first->next=x;

x=first;

Conduct an analysis of the proposed code and identify among the following options of
operations that can be performed with stacks, which of them corresponds. You can do
use of a desk test.
Select an answer.
a. The function allows visualizing the elements of the stack
b. The function allows removing elements from the stack
c. The function allows inserting elements into the stack
d. The function allows locating elements of the stack

Question 10
Points: 1
In the following code instruction, a structure is declared for the implementation of
a stack that will store integer type numbers.

struct stack{
int number;
struct stack *next;

Below is the code for the definition of the insert function, which allows
insert data to the stack.

void insert (void) {


new struct stack;
cout << "Enter the INTEGER data: ";
cin >> inicio->numero;
if (c==NULL)
{
c=start;
start->next=NULL;
}
else
{
start->next=c;
c=start;
}
}

If you want to replace the new operator with the malloc() function for dynamic management of
memory What would be the correct instruction?
Select an answer.
a. start=(int stack *)malloc(sizeof(int));
b. start=(struct stack *)malloc(sizeof(struct stack));
c. start = (struct stack *)malloc(sizeof(int stack));
d. start=malloc() struct stack;
Question 11
Points: 1
Dynamic data structures allow memory allocation at runtime.
According to the above, what is the limit of dynamic memory that can be assigned to a
object of a program that is currently running?
Select an answer.
a. It depends on the compiler you are using in the compilation of the program
It depends on the data type of the object that allocates the memory.
c. It depends on the C++ operator or the C function that is being implemented.
program for memory management
d. The limit for dynamic allocation can be as large as the amount of
physical memory of your computer
Question 12
Points: 1

Linear data structures of the stack type allow for the interaction and management of data.
different types, this allows the information stored in the structures to be able to
consult, insert, view, and delete data.

According to the above, we can identify the operations that are allowed to be performed with
stack data structures.

Select an answer.
a. Remove the last element entered into a stack of 5 elements
b. Remove the second element entered from a stack that has 5 elements
c. Remove the first element entered into a stack of 5 elements
d. Remove any of the 5 elements that are in the stack

Question 13
Points: 1
A Stack is considered a linear data structure of type:
Select an answer.
a. FIFO
b. LIFO/FIFO
c. LIFO
d. FIFO/FIFO
Question 14
Points: 1
Circular lists have some advantages over lists
simplely linked one of them is that each node of a circular list is accessible from
any other node of it. That is, given a node, one can traverse the entire list.
However, some inconveniences may arise in their implementation.

From the following options, select the one that refers to the difficulty that can arise.
present their use.

Select an answer.
a. There may be difficulty in the operations of insertion and search of a
node
b. A singly linked list can only be completely traversed if it
part of its first node
c. The operations of concatenation and division of lists cannot be performed with
circular lists
d. Infinite loops or cycles can be produced

Question 15
Points: 1
Data structures are classified into linear structures and non-linear structures.
According to the above, indicate which of the following options is not considered a
linear data structure?
Select an answer.
a. List
b. Graph
c. Doubly linked list
d. Pole

Your final grade in this quiz is


16.433333333333 / 17

You might also like