Fareast International University
Department of Computer Science and Engineering
CSE 1314: Data Structures Lab Summer 2023
Lab Final Examination
Time: 40 minutes Date:01.09.2023
Instructor: Anika Tasnim Islam
Name: ID:
Answer Question No. B and C First.
A. Choose the correct Answer.
1) How can we describe an array in the best possible way?
a. The Array shows a hierarchical structure.
b. Arrays are immutable.
c. Container that stores the elements of similar types
d. The Array is not a data structure
2) Which of the following is the correct way of declaring an array?
a. int number[10];
b. int number;
c. number{20};
d. array number[10];
3) How can we initialize an array in C language?
a. int arr[2]=(10, 20)
b. int arr(2)={10, 20}
c. int arr[2] = {10, 20}
d. int arr(2) = (10, 20)
4) Which of the following is the advantage of the array data structure?
a. Elements of mixed data types can be stored.
b. Easier to access the elements in an array
c. Index of the first element starts from 1.
d. Elements of an array cannot be sorted
5) Which of the following is the disadvantage of the array?
a. Stack and Queue data structures can be implemented through an array.
b. Index of the first element in an array can be negative
c. Wastage of memory if the elements inserted in an array are lesser than the allocated size
d. Elements can be accessed sequentially.
6) What is the output of the below code?
#include <stdio.h>
int main()
{
int arr[5]={10,20,30,40,50};
printf("%d", arr[5]);
return 0;
}
a. Garbage value
b. 10
c. 50
d. None of the above
7) Which one of the following is the process of inserting an element in the stack?
a. Insert
b. Add
c. Push
d. None of the above
8) If the size of the stack is 10 and we try to add the 11th element in the stack then the condition is known as___
a. Underflow
b. Garbage collection
c. Overflow
d. None of the above
9) Which one of the following is not the application of the stack data structure
a. String reversal
b. Recursion
c. Backtracking
d. Asynchronous data transfer
10) Which data structure is mainly used for implementing the recursive algorithm?
a. Queue
b. Stack
c. Binary tree
d. Linked list
11) Which data structure is required to convert the infix to prefix notation?
a. Stack
b. Linked list
c. Binary tree
d. Queue
12) Which of the following is the prefix form of A+B*C?
a. A+(BC*)
b. +AB*C
c. ABC+*
d. +A*BC
13) If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?
a. 1234
b. 2134
c. 4321
d. None of the above
14) If the elements '1', '2', '3' and '4' are inserted in a queue, what would be order for the removal?
a. 1234
b. 4321
c. 3241
d. None of the above
15) A list of elements in which enqueue operation takes place from one end, and dequeue operation takes place from
one end is__
a. Binary tree
b. Stack
c. Queue
d. Linked list
16) Consider the following code
struct node
{
int data;
struct node *next;
}
node ptr;
Which one of the following is the correct option to create a new node?
a. ptr= (node*)malloc(sizeof(node*))
b. ptr=(node)malloc(sizeof(node))
c. ptr=(node*)malloc(sizeof(node))
d. None of the above
17) Which of the following statement is not true about the doubly linked list?
a. We can traverse in both the directions.
b. It requires extra space
c. Implementation of doubly linked list is easier than the singly linked list
d. It stores the addresses of the next and the previous node
18) What is the maximum number of children that a node can have in a binary tree?
a. 3
b. 1
c. 4
d. 2
19) Which one of the following techniques is not used in the Binary tree?
a. Randomized traversal
b. Preorder traversal
c. Postorder traversal
d. Inorder traversal
20) Which of the following options is not true about the Binary Search tree?
a. The value of the left child should be less than the root node
b. The value of the right child should be greater than the root node.
c. The left and right sub trees should also be a binary search tree
d. None of the above
21) Which data structure is used for implementing recursion?
a)Stack
b)Queue
c)Linked-List
d) Array
22) The data structure required for Breadth First Traversal on a graph is?
a)Array
b)Stack
c)Tree
d) Queue
23) Which is the most appropriate data structure for reversing a word?
a)stack
b)queue
c)graph
d) tree
24) What is a dequeue?
a) A queue implemented with both singly and doubly linked lists
b) A queue with insert/delete defined for front side of the queue
c) A queue with insert/delete defined for both front and rear ends of the queue
d) A queue implemented with a doubly linked list
25) The data structure that allows the insertion, as well as the deletion from both the ends, are:
a. String type of data structure
b. Queue type of data structure
c. Stack type of data structure
d. Dequeue type of data structure
B. Write a C program in your computer where you have to find the largest of three
numbers.
C. Write a C program in your computer where you have to compute the sum of 1 to 10
numbers.