0% found this document useful (0 votes)
94 views5 pages

DSA CA3 Questionaire 2nd Year CSE A

The document contains 20 single mark questions and 5 five mark questions related to data structures and algorithms. Some of the questions ask about linear data structures, queue implementation, stack operations, array indexing, time complexities, linked list operations, matrix representations and more. The 5 mark questions involve designing postfix expressions, removing duplicates from arrays, implementing queues using stacks, counting prime numbers, sparse matrix representations, algorithm analysis using Big-O notation and more.

Uploaded by

mahor
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)
94 views5 pages

DSA CA3 Questionaire 2nd Year CSE A

The document contains 20 single mark questions and 5 five mark questions related to data structures and algorithms. Some of the questions ask about linear data structures, queue implementation, stack operations, array indexing, time complexities, linked list operations, matrix representations and more. The 5 mark questions involve designing postfix expressions, removing duplicates from arrays, implementing queues using stacks, counting prime numbers, sparse matrix representations, algorithm analysis using Big-O notation and more.

Uploaded by

mahor
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
You are on page 1/ 5

1 mark questions

1. Which of the following is a linear data structure?


A. Array
B. Avl Tree
C. Binary tree
D. Graph
2. When Pop() operation is done on empty queue that is known as?
3. Which of the data structures can be used to implement queues?

i) Stack
ii) Arrays
iii) LinkedList
iv) All of the above

4. In circular linked list insertion of a record involves the modification of


1) no pointer
2) 1 pointer
3) 2 pointers
4) 3 pointers
5. To make a queue empty, elements can be deleted till
a) front=rear+1
b) front=rear-1
c) front=rear
d) none of these
6. What would be the Prefix notation for the given equation?
(a+(b/c)*(d^e)-f)
a) -+a*/^bcdef
b) -+a*/bc^def
c) -+a*b/c^def
d) -a+*/bc^def

7. Which of the following is a Self Referencing Data Structure?


a. Array
b. Linked List
c. Stack
d. Queue

8. Write these time complexities in descending order –


a. O(n)
b. O(𝑛𝑛2 )
c. O(log n)
d. O(n log n)
9. Which of the following are applications of linked lists?
a. Implementing file System
b. Chaining in Hash Tables
c. Binary Tree Implementation
d. All of the Above
10. Which of the following problems can’t be solved using recursion?
a. Factorial of Number
b. Nth Fibonacci Number
c. Length of a String
d. Problem without Base Case.
11. If the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop,
push(2), pop are performed on a stack, the sequence of popped out values–
a. 2,2,1,1,2
b. 2,2,1,2,2
c. 2,1,2,2,1
d. 2,1,2,2,2
12. A postfix expression is merely the reverse of the prefix expression
a. True
b. False
c. Cannot say
d. Sometimes

13. What will be the output of the programme ?(Arghya)

int main ()
{
int arr[5] = {13, 34, 67, 15, 45};
int *x=arr;
int y=*x + 2;
printf("%d", y);

return 0;
}
a. 34
b. 67
c. 15
d. 45
14. What will be the resulting array after rotating arr[]={1, 2, 3, 4, 5} by 2 anti-
clockwise?
a. 2, 1, 3, 4, 5
b. 3, 4, 5, 1, 2
c. 4, 5, 1, 2, 3
d. 1, 2, 3, 5, 4
15. A data structure is said to be _____ if its elements form a sequence.
16. How is the 2nd element in an array accessed based on pointer notation?
a. *a + 2
b. *(a + 2)
c. *(*a + 2)
d. &(a + 2)
17. Which of the following is a disadvantage of dynamic arrays?
a. Locality of reference
b. Data cache utilisation
c. Random access
d. Memory leak
18. struct Node{
int data;
struct Node* next;
};
struct Node* head;

int main(){
int c = sizeof(head);
printf("The size of the Node is %d",c);
return 0;
}
a. 4
b. 6
c. 8
d. 10
19. If the address of arr[1] of the given array is -1730151612, and it takes a space
of 4 bytes in the memory, then what will be the output of the programme ?

int main ()
{
int arr[8]={5, 10, 15, 20, 25, 65, 34, 89};
int *x = &arr[2];
printf("%d", x+5);
return 0;
}
a. -1730151613
b. -1730151621
c. -1730151603
d. -1730151588
20. An array is declared as: int arr[n][n]; Each element follows the condition: f[j][i]=(j-i).
What is the sum of all the elements of the array arr?
5 marks question

1. Design a into postfix within the stack(with all step) :


A-(B/C+(D%E*F)/G)*F
2. Write a program to remove duplicates from an array
3. Implement a queue using the stack data structure.
4. Write the full algorithm to count the number of primes in the range 1 to n
5. What is sparse matrix?(2)
Write the algorithm to convert a normal matrix to a sparse matrix representation
form.(3)
6. Write the mathematical definitions of bigO, bigOhmega, bigSigma with sample
graphs
7. Write the comparison between big O, big Sigma, big Theta, small O, small sigma with
respect to reflectivity, symmetry and transitivity.
8. Write a function to create (if no node is present) and append (if node is present) a
node of a doubly linked list.
9. What is the default return type of malloc()? Why do we need to typecast it?Do a
comparison among Data Type, Abstract Data Type and Data structure. (1+2+2)
10. Write an algorithm to print the Reverse of a linked list without actually reversing the
list
11. Write a difference between linked list, static array, and dynamic array.
12. What is Sparse matrix and Advantages of using Sparse matrix?
Write an algorithm/pseudocode to count the number of nodes in a Singly Linked
List?(2+3)
13. a. Which of the following function will grow faster?
I. √𝑛𝑛 or logn?
Ii. nlogn or log𝑛𝑛𝑛𝑛
Prove your claim.[3]
b. Determine the time complexity of the algorithm:[2]
Void fun(int)
{
for (i=1; i<=n; i++)
{
for (j=1; j<=1; j++)
{
for( k=1; k<= j; k++)
printf(“hello \n”);
}
}
}
14. Consider the arithmetic expression P, written in postfix notation:
12,7,3,-,/,2,1,5,+,*,+
a. Translate P, into its equivalent infix expression.[2]
b. Evaluate the expression.[3]
15. Write an algorithm to create a function for deleting an entire linked list.
16. Write an algorithm to create a function to delete before an element in a doubly linked
list.
17. Create an array of size N-1 such that it only contains distinct integers in the range of
1 to N (in unsorted order). Print all the array elements and the missing element
between 1 to N in the array.
18. Write a c program to rotate an array (left Rotation) n times(here number of rotation is
half of the size of array ,where array size given by user).
19. Write an algorithm to find the smallest and largest element in a single linked list.
Write the time complexity of the algorithm used. [4+1]
20. Make a comparison between a linked list and a linear array. Which one will
you prefer to use and when?(3+2)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy