Professional Documents
Culture Documents
Subject Code:BCA309
CO Distribution Analysis At A Glance
C.O. Type C.O. Total In-Percentage
CO1 33 16.84
CO2 40 20.41
CO3 32 16.33
CO4 36 18.37
CO5 32 16.33
CO6 23 11.73
Page 1 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
Modul
Sl.No. Question Marks CO BL
e
1 Define ADT with suitable example. 2 1 CO1 BL1
(i) A full binary tree with n leaves contains: a) n b)
log2n c) 2n-1 d) 2n nodes.
2 (ii) Given a Binary search tree, which of the following 2 4 CO1 BL1
traversals would print the values of the nodes in sorted
order? a) Preorder b) Postorder c) Inorder d) None of
the above.
3 Define a B-Tree with a suitable example. 2 4 CO1 BL1
4 Define a Stack with a suitable example. 2 3 CO1 BL1
5 Explain how do you test for an empty stack. 2 3 CO2 BL2
What do you meant by fully parenthesized expression?
6 2 3 CO2 BL2
Give a example.
What are the postfix and prefix forms of the expression
7 2 3 CO2 BL2
A+B*(C-D)/(P-R)?
8 What are the advantages of Python? 2 1 CO1 BL1
9 Explain Python Functions and Packages? 2 1 CO1 BL1
How to overload constructors or methods in Python
10 2 1 CO1 BL1
with example.
What is the expected time required to search for a
value in a Binary Search Tree containing n nodes?
11 2 4 CO2 BL2
Explain it with a reasonable assumption about the
structure of the tree.
What is the difference between remove() function and
12 2 1 CO2 BL2
del statement?
Explain swapcase() function in the Python with proper
13 2 1 CO1 BL1
example.
14 Why do we use join() function in Python? 2 1 CO1 BL1
Is Python a compiled language or an interpreted
15 2 1 CO2 BL2
language? Explain.
16 Explain what do you mean by slicing in python. 2 1 CO1 BL1
17 What is lambda function in Python? 2 1 CO1 BL1
18 How can you generate random numbers in Python? 2 1 CO1 BL1
What will the following snippet of code print?
(i)
myint = 10
def myfunction():
myint = 20
19 myfunction() 2 1 CO2 BL2
print(myint)
(ii)
my_list = [7, 9, 8, 2, 5, 0, 1, 3, 6]
my_list.pop(2)
print(my_list)
Page 2 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
What are the advantages of Binary search over Linear
20 2 5 CO2 BL2
search?
Write the drawbacks of array implementation of
21 2 3 CO2 BL2
Queue?
Write the steps involved in the insertion and deletion of
22 2 3 CO2 BL2
an element in a stack.
Write the stack overflow and underflow condition. List
23 the area of applications where stack data structure can 2 3 CO2 BL2
be used?
What is a Stack? Which data structure is used to
24 2 3 CO2 BL2
perform recursion?
25 Describe the types of Data Structures. 2 3 CO1 BL1
Are Stack and Queue the same thing? If not, explain
26 2 3 CO1 BL1
why.
What are three different ways of fetching every third
27 2 3 CO1 BL1
item in a List?
What is the default return type of malloc()? Why do we
28 2 3 CO1 BL1
need to typecasting?
How can a polynomial such as 6x6 + 4x2 – 2x + 10 be
29 2 3 CO2 BL2
represented by a linked list?
30 Why is hashing referred as a heuristic search method? 2 5 CO2 BL2
What is the primary advantage of hashing over
31 2 5 CO2 BL2
deterministic search algorithms?
32 What is a Max Heap? 2 5 CO1 BL1
Evaluate the following postfix expression:
33 2 3 CO2 BL2
4, 5, 4, 2, ^, +, *, 2, 2, ^, 9, 3, /, *,-
Page 3 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
Predict the behavior of the following codes:
(i)
List = list("String")
print(List)
(ii)
a = True
b = False
c = False
34 if not a or b: 2 2 CO2 BL2
print(1)
print(2)
print(3)
else:
print(4)
35 What are the features of stacks? 2 3 CO1 BL1
List out the different linear and non-linear data
36 2 3 CO1 BL1
structures.
Mention with examples different library functions for
37 2 2 CO1 BL1
List manipulation in Python.
What are the postfix and prefix forms of the expression
38 2 3 CO2 BL2
(a + b) * (c + d) / f?
What is a recursive function? Explain with suitable
39 2 2 CO1 BL1
example.
What are the advantages in the array implementation
40 2 3 CO1 BL1
of list?
41 Differentiate arrays and linked lists. 2 3 CO1 BL1
Binary search cannot be performed on a linked list.
42 5 3 CO3 BL3
Examine.
List out the areas in which data structures are applied
43 2 1 CO1 BL1
extensively.
What are the postfix and prefix forms of the expression
44 2 3 CO1 BL1
(((a / b) - c) + (d * e)) - (a * c)?
45 Give some applications of stack. 2 3 CO1 BL1
46 Define circular linked list with example? 2 3 CO1 BL1
47 Differentiate between data types and data structures. 5 1 CO2 BL2
48 Define Graph and its components. 2 4 CO2 BL2
49 Describe the two types of Graphs with examples. 2 4 CO2 BL2
50 What is a complete binary tree? Give an example. 2 4 CO1 BL1
Page 4 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
51 Compare complete binary tree and full binary tree. 5 4 CO2 BL2
Write the code for swapping two values
52 2 1 CO1 BL1
programmatically.
53 Define double ended queue. 2 3 CO1 BL1
54 How is the queue implemented by linked list? 5 3 CO2 BL2
Predict the behavior of the following codes:
(i)
for i in (2,3,4):
print("i")
(ii)
x=1234
while x%10:
x=x//10
print(x)
55 (iii) 5 1 CO3 BL3
x=2
y=6
x = x + y/2 + y//4
print(x)
(iv)
z = set('abc$de')
print('a' in z)
(v)
for i in range(1,11):
print("%d"%i)
56 Compare singly linked list with circular linked list. 5 3 CO5 BL5
Distinguish between linear and nonlinear data
57 10 2 CO2 BL2
structures with detailed examples.
What is time complexity? List out the time complexities
58 10 2 CO2 BL2
of different sorting algorithms.
What is space complexity? How is it different from time
59 complexity? What is the space complexity of a list of n 10 2 CO2 BL2
elements?
Evaluate how the Merge Sort would work on an integer
60 5 5 CO5 BL5
list of [6, 5, 3, 1, 8, 7, 2, 4]. Show all the iterations.
Evaluate how the Bubble Sort would work on an
61 integer list of [6, 5, 3, 1, 8, 7, 2, 4]. Show all the 5 5 CO5 BL5
iterations.
Evaluate how the Selection Sort would work on an
62 integer list of [6, 5, 3, 1, 8, 7, 2, 4]. Show all the 5 5 CO5 BL5
iterations.
Evaluate how the Insertion Sort would work on an
63 integer list of [6, 5, 3, 1, 8, 7, 2, 4]. Show all the 5 5 CO5 BL5
iterations.
Evaluate how the Quick Sort would work on an integer
64 5 5 CO5 BL5
list of [6, 5, 3, 1, 8, 7, 2, 4]. Show all the iterations.
Given a list of integers “nums” that is sorted in
ascending order, and an integer “target”, recognize and
65 provide the suitable function to search "target" in nums. 10 5 CO3 BL3
If the "target" exists, then return its index. Otherwise,
return -1.
Page 5 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
Solve the following programmatically:
Page 6 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
Write a script to insert a node at the nth position in a
73 10 3 CO6 BL6
Doubly linked list.
Print the following:
(i) (ii)
* 1
** 23
. .
. .
Page 7 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
For railway reservation the queue data structure is
88 5 3 CO5 BL5
preferred —Justify.
Analyze and write a function to check whether a queue
89 5 3 CO4 BL4
is full or empty.
Describe with examples how to evaluate arithmetic
90 10 3 CO2 BL2
expressions using stacks.
Give an algorithm for the push and pop operations on
91 5 3 CO2 BL2
stack using a linked list.
Write the function to examine whether the stack is full
92 5 3 CO3 BL3
or empty.
If the depth of the binary tree is k, the maximum
93 5 4 CO5 BL5
number of nodes in the binary tree is 2k-1. Justify.
For the given binary search tree, if we remove the root
and replace it with something from the left subtree,
what will be the value of the new root? Justify your
answer.
94 5 4 CO5 BL5
Page 8 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
Discuss with respect to following tree:
96 5 4 CO3 BL3
(i) Preorder
(ii) Inorder
(iii) Postorder
97 10 4 CO2 BL2
Page 9 of 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50
List out the properties of B-Tree and B+Tree with
100 10 4 CO2 BL2
proper examples.
101 Analyze the properties of binary heap. 5 4 CO4 BL4
Define a heap and show how it can be used to
102 5 4 CO4 BL4
represent a priority queue.
Write an algorithm for preorder, inorder and postorder
103 10 4 CO4 BL4
traversal of a binary tree.
Explain the following operations on a binary search
tree with suitable algorithms:
(ii) I, J, K, C, B, F, D, G
Discuss the different traversal techniques in binary tree
113 10 4 CO5 BL5
with suitable algorithms and examples.
Explain the construction of expression tree with
114 5 4 CO4 BL4
example.
115 Give the applications of trees. 5 4 CO4 BL4
Show the result of inserting 15, 17, 6, 19, 11, 10, 13,
116 20, 8, 14, 12 one at a time into an initially empty binary 10 4 CO3 BL3
min heap.
Show the result of performing three delete min
117 5 4 CO3 BL3
operations in the final binary min heap obtained.
Illustrate how delete operation is performed on binary
118 5 4 CO3 BL3
heap.
Page 10 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Consider the binary search tree given below.
(iii) Insert 11, 22, 33, 44, 55, 66, and 77 in the tree
123 What is a graph and its types? Explain with example. 5 4 CO5 BL5
124 Compare directed graph and undirected graph. 5 4 CO5 BL5
125 Compare weighted graph and unweighted graph. 5 4 CO5 BL5
Page 11 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Consider the graph given below. Create the adjacency
matrix and adjacency list for it.
128 Create a complete undirected graph having five nodes. 5 4 CO6 BL6
Page 12 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Given the following adjacency matrix, draw the graph
for it.
V(G) = {4, 3, 2, 1}
131 E(G) = {(2, 1), (3, 1), (3, 3), (4, 3), (1,4)} 5 4 CO6 BL6
Page 13 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Consider the weighted graph given below. Create the
adjacency matrix for it.
Preorder: 20, 15, 10, 18, 17, 30, 25, 40, 35, 38, 50
What is the precondition of performing binary search in
149 5 5 CO6 BL6
an array? Write the Binary Search algorithm.
Write a program to implement the Merge Sort on an
150 10 5 CO6 BL6
user-given array.
Write a program to implement the Quick Sorton an
151 10 5 CO6 BL6
user-given array.
Write the programs to implement the following on an
user-given array:
152 10 5 CO6 BL6
(i) Selection Sort
Page 15 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
If a filesystem has a block size of 4096 bytes, this
means that a file comprised of only one byte will still
use 4096 bytes of storage. A file made up of 4097
bytes will use 4096*2=8192 bytes of storage. Knowing
this, can you fill in the gaps in the calculate_storage
function below, which calculates the total number of
bytes needed to store a file of a given size?
def calculate_storage(filesize):
block_size = 4096
full_blocks = ___________
partial_block_remainder = _______________
157 10 1 CO3 BL3
# Depending on whether there's a remainder or not,
return
if partial_block_remainder > 0:
return ___________
return ________
print(calculate_storage(1))
print(calculate_storage(4096))
print(calculate_storage(4097))
print(calculate_storage(6000))
153 = (1*1*1)+(5*5*5)+(3*3*3)
where:
(1*1*1)=1
171 10 3 CO4 BL4
(5*5*5)=125
(3*3*3)=27
So:
1+125+27=153
Page 17 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Write a program to print the following pattern:
121
12321
1234321
173 5 1 CO4 BL4
123454321
1234321
12321
121
1
Write a program to print the following pattern:
1 1
174 5 1 CO3 BL3
1 2 1
1 3 3 1
1 4 6 4 1
If the sum of the factorial of digits of a number is equal
to the number itself, the number is called a special
number.
N = 145
Sum = 1! + 4! + 5!
175 5 1 CO3 BL3
= 1 + (4*3*2*1) + (5*4*3*2*1)
= 1 + 24 + 120
= 145 (N)
#include <stdio.h>
int main() {
printf("%d", z);
return 0;
}
Predict the output of this program.
#include <stdio.h>
int main() {
int a = 7, b;
182 2 1 CO4 BL4
b = ++a + a-- - --a;
printf("%d", b);
return 0;
}
Change the following do-while loop into a for loop. Also
rewrite the code by changing the do-while into a while
loop.
int num;
scanf("%d", &num);
183 2 2 CO3 BL3
do{
printf("%d", x);
scanf("%d", &num);
}while(num != 999);
184 Explain sparse matrix. 2 3 CO5 BL5
What do you mean by Dangling Pointer Variable in C
185 2 3 CO5 BL5
Programming?
186 What is data structure 2 2 CO1 BL1
Page 19 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Find the results of the following C codes:
(a) #include <stdio.h>
int main()
{
int d, a = 1, b = 2;
d = a++ + ++b;
printf("%d, %d, %d", d, a, b);
return 0;
}
(b) #include <stdio.h>
int main()
187 { 5 1 CO4 BL4
int d, a = 1, b = 2;
d = ++a +++b;
printf("%d %d %d", d, a, b);
return 0;
}
(c) #include<stdio.h>
int main()
{
int a=0;
a = printf("4");
printf("%d",a);
return 0;
}
(a) What will occur if an array is not initialized, Explain.
(b) There are two types of int-type array data. The first
188 one has 50 elements, while the second one has 30. 5 1 CO6 BL6
Can we transfer a 50-element array to a 30-element
array? Defend it.
189 Give the node structure of a doubly linked list. 2 3 CO6 BL6
190 What is the basic purpose of header of the linked list? 2 3 CO4 BL4
Which sorting algorithm is best if the list is already
191 2 3 CO4 BL4
sorted? Why?
Draw the queue structures in each case when the
following operations are performed on an empty
queue.
(a) Add A, B, C, D, E, F
(d) Add H
(f) Add I
Page 20 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
"Predict the outputs of the following (there are no
errors):
(a)
#include<stdio.h>
void main() {
int color = 2;
switch(color) {
case 0: printf("Black");
case 1: printf("Blue");
case 2: printf("Green");
case 3: printf("Aqua");
default: printf("Other");
}
}
(b)
#include <stdio.h>
void main() {
char arr[]={ 'A', 'B', 'c', 'd', 'E', 'f' };
int size = sizeof(arr) / sizeof(arr[0]);
printf("%d ", size);
}
(c)
193 #include <stdio.h> 5 1 CO4 BL4
void main() {
float f1 = 0.1;
if (f1 == 0.1)
printf("equal ");
else
printf("not equal ");
}
(d)
#include <stdio.h>
#include <string.h>
void main() {
char a[] = "%d ";
printf(a, 85);
}
(e)
#include <stdio.h>
void main() {
int a= -1, b = -a;
int x,y;
x = (a> 0) && (b < 0) || (a< 0) && (b > 0);
y = (a<= 0) || (b >= 0) && (a>= 0) || (b <= 0);
printf("%d ",x == y);
}
Write a program which performs the following tasks:
Page 21 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of
Consider an array A to be an n x n square matrix. The
value n is defined as a constant. You need to write a
program which will do the following:
196 (a) Find the number of non-zero elements in A. 10 1 CO2 BL2
Page 22 22
© Q.Bank:BCA309, Printed by:sacharya, Date & Time:13-11-23 12:16:50 of