II SEM BCA NEP - QB - Revised - Final
II SEM BCA NEP - QB - Revised - Final
II SEM BCA NEP - QB - Revised - Final
QUESTION BANK
Page 1 of 25
BCACACN201- Discrete Mathematical Structures
UNIT -I
Questions carrying 2 marks:
Page 2 of 25
Questions Carrying 4 or more marks.
1. Write which of these is a tautology or a fallacy with the help of truth table.
i) p˅ (ךp˄q) ii) (p˄q)˄ (ךp˄q)
2. Using truth table, show that (p˄q) => p and p => (p˅q) are both tautologies, where p and
q are any two statements.
3. Write the following statements in symbolic form and give their negations.
i) If he works hard, he will pass the examination.
ii) If it rains, he will not go for a walk.
4. Prove by means of truth table that, (p˄q) => (p˅q) is a tautology but (p˅q) => (p˄q) is
not.
5. Prove by means of truth table that, p q = (p→ q) ˄ (q→ p)
6. Show the following implications:
i. (p˄q) => (p→q)
ii.p => (q→p)
7. Show the following equivalences:
i. p→(q→p) ךp→ (p→q)
ii. p →(q˅r) (p→q) ˅(p→r)
8. Prove by means of truth table that, (ךp→q) = p˄ ךq
9. A={1,2,3} B={1,2,5,7,9} Write A-B, B-A, A+B, A∪B, A∩B.
10. A={1} B={a,b} C={2,3} write AXB, BXA, A2, B2, A2XB B2XA, AXBXC, C2XA
11. A={x/ x is an integer and 0 ≤ 𝑥 ≤ 5 }, B={3,4,5,17} and C={1,2,3} Find
i. A∪B ii. A∩B iii. A-B iv. A-C iv. A∩C
12. A={α, β } and B={1, 2, 3} Find A2, B2, A2 X B, A X B and B X A
13. A={3,4,5,17} B={1,2,3} C={x/X is an integer and 0 ≤ 𝑥 ≤ 5} write
A∪B, A∪C, B∪C, B-C, A-C, B∩C.
14. Let X = {1,2,3,4} and R = {(x,y) | x>y} Draw the graph of R and give its matrix.
15. R={<1,1> <1,2>, <1,4>, <2,1>, <2,2>, <2,3>, <3,2>, <3,3>, <4,2>, <4,4>} Construct
relation matrix of R and draw digraph of R
16. R={(1,1), (1,2), (1,4), (2,1), (2,2), (2,3), (3,2), (3,3), (4,2), (4,4)} Construct relation
matrix of R and draw digraph of R
17. Let X={1,2,3,….,7} and R={<x,y>|x-y is divisible by 3}, Show that R is an equivalence
relation.
18. Let X={ball,bed,dog,let,egg} & R={<x,y>|x,y∈X ∧ xRyis x and y contain some common
letter}. Prove that R is a compatibility relation
19. R={(1,2), (3,4), (2, 2)} S={(4,2), (2,5), (3,1), (1,3)} Write R ⃘ S, R ⃘ R , S ⃘ S, S ⃘R and R
⃘(S ⃘R)
20. Let X={1,2,3,….,7} and R={<x,y>|x-y is divisible by 3}, Draw the graph of the relation.
21. . Given the relation matrices
Page 3 of 25
1 0 1 1 0 0 1 0
MR = ⌈1 1 0⌉ MS =⌈1 0 1 0 1⌉
1 1 1 0 1 0 1 0
Find M R ⃘ S, 𝑀𝑅̃ , 𝑀𝑆̃ , 𝑀𝑅⃘̃ S and show that 𝑀𝑅⃘̃ S = 𝑀𝑆̃ ⃘ 𝑀𝑅̃
UNIT-II
Questions carrying 2 marks
1. Define partial order relation. Give an example
2. What is lexicographic ordering?
3. Define surjective function. Give an example.
4. Define injective function. Give an example.
5. Define bijective function. Give an example.
6. Define inverse function. Give an example.
7. Define domain of a function. Give an example
8. Define range of a function, with an example.
9. Let x={1,5,p,Jack}, Y={2,5,7,q,Jill} and f={<1,2>,<5,7>,<p,q>,<Jack,q>}, Find Df
and Rf
10. Define product rule.
11. There are 32 microcomputers in a computer center. Each microcomputer has 24 ports.
How many different ports to a microcomputer in the center are there?
12. A new company with just two employees, Sanchez and Patel, rents a floor of a building
with 12 offices. How many ways are there to assign different offices to these two
employees?
13. The chairs of an auditorium are to be labelled with an uppercase English letter
followed by a positive integer not exceeding 100. What is the largest number of chairs
that can be labelled differently?
14. How many different bit strings of length seven are there?
15. Define the sum rule.
16. A student can choose a computer project from one of three lists. The three lists contain
23, 15, and 19 possible projects, respectively. No project is on more than one list. How
many possible projects are there to choose from?
17. Define the subtraction rule.
18. What is Pigeonhole principle? Give an example.
19. How many students must be in a class to guarantee that at least two students receive the
same score on the final exam, if the exam is graded on a scale from 0 to 100 points?
20. In how many ways can we select three students from a group of five students to stand
in line for a photo session?
21. An office building contains 27 floors and has 37 offices on each floor. How many
offices are in the building?
22. Write the formula to calculate P(n,r).
23. Write the formula to calculate C(n,r).
24. How many ways are there to select five players from a 10-member tennis team to
make a trip to a match at another college?
25. Let S = {1, 2, 3, 4, 5}. List all the 3-permutations of S.
26. Let S = {1, 2, 3, 4, 5}. List all the 3-combinations of S.
Page 4 of 25
Questions Carrying 4 or more marks.
1. Draw the Hasse diagram of the set A, under the partial ordering relation “divides” and
indicate those which are totally ordered.
A = {1,2,3,6,12}
2. Let X = {2,3,6,12,24,36} and the relation <= be such that x ≤ y, if x divides y. Draw
the Hasse diagram of (X, ≤)
3. Let f(x)=x+2, g(x)=x-2 and h(x)=3x for x∈R, R is a set of real numbers. Find
f ⃘ g, f ⃘ f, g ⃘ g, g ⃘ f and f ⃘(h ⃘g)
4. Define Surjective, injective and Bijective functions with example.
5. Let x={1,2,3} f, g, h and s are the functions from X to X given by
f={(1,2), (2,3),(3,1)} h={(1,1), (2,2), (3,1)}
g={(1,2), (2,1) , (3,3)} s={(1,1), (2,2), (3,3)} Find f ⃘ g, g ⃘ f, s ⃘ s,
f ⃘ h ⃘ g, s ⃘ g and f ⃘ s
1
6. Show that functions f(x)=x3 and g(x)=𝑥 3 for x𝜀 R are inverse of one another.
7. How many different license plates can be made if each plate contains a sequence of
three uppercase English letters followed by three digits (and no sequences of letters are
prohibited, even if they are obscene)?
8. Suppose that either a member of the mathematics faculty or a student who is a
mathematics major is chosen as a representative to a university committee. How many
different choices are there for this representative if there are 37 members of the
mathematics faculty and 83 mathematics majors and no one is both a faculty member
and a student?
9. How many bit strings of length eight either start with a 1 bit or end with the two bits
00?
10. A computer company receives 350 applications from computer graduates for a job
planning a line of new Web servers. Suppose that 220 of these applicants majored in
computer science, 147 majored in business, and 51 majored both in computer science
and in business. How many of these applicants majored neither in computer science nor
in business?
11. There are 18 mathematics majors and 325 computer science majors at a college. In how
many ways can two representatives be picked so that one is a mathematics major and
the other is a computer science major?
12. How many ways are there to select a first-prize winner, a second-prize winner, and a
third-prize winner from 100 different people who have entered a contest?
13. A group of 30 people have been trained as astronauts to go on the first mission to Mars.
How many ways are there to select a crew of six people to go on this mission (assuming
that all crew members have the same job)?
14. A multiple-choice test contains 10 questions. There are four possible answers for each
question. A) In how many ways can a student answer the questions on the test if the
student answers every question? B) In how many ways can a student answer the
questions on the test if the student can leave answers blank?
15. Let S = {1, 2, 3, 4, 5}. List all the 3-permutations and 3-combinations of S.
Page 5 of 25
UNIT-III
Questions carrying 2 marks
1. There are many lotteries now that award enormous prizes to people who correctly
choose as set of six numbers out of the first n positive integers, where n is usually
between 30 and 60. What is the probability that a person picks the correct six numbers
out of 40?
2. Find the probability that a hand of five cards in poker contains four cards of one kind.
3. What is the probability that a poker hand contains a full house, that is, three of one kind
and two of another kind?
4. A sequence of 10 bits is randomly generated. What is the probability that at least one
of these bits is 0?
5. What is the probability that a positive integer selected at random from the set of positive
integers not exceeding 100 is divisible by either 2 or 5?
Page 6 of 25
6. Suppose that a die is biased (or loaded) so that 3 appears twice as often as each other
number but that the other five outcomes are equally likely. What is the probability that
an odd number appears when we roll this die?
7. A bit string of length four is generated at random so that each of the 16 bit strings of
length four is equally likely. What is the probability that it contains at least two
consecutive 0s, given that its first bit is a 0? (We assume that 0 bits and 1 bits are equally
likely.)
8. What is the conditional probability that a family with two children has two boys, given
they have at least one boy?
9. Suppose E is the event that a randomly generated bit string of length four begins with
a 1 and F is the event that this bit string contains an even number of 1s. Are E and F
independent, if the 16 bit strings of length four are equally likely?
10. Are the events E, that a family with two children has two boys, and F, that a family with
two children has at least one boy, independent?
11. Are the events E, that a family with three children has children of both sexes, and F,
that this family has at most one boy, independent? Assume that the eight ways a family
can have three children are equally likely.
12. Suppose that we have found that the word “Rolex” occurs in 250 of 2000 messages
known to be spam and in 5 of 1000 messages known not to be spam. Estimate the
probability that an incoming message containing the word “Rolex” is spam, assuming
that it is equally likely that an incoming message is spam or not spam. If our threshold
for rejecting a message as spam is 0.9, will we reject such messages?
13. Suppose that we train a Bayesian spam filter on a set of 2000 spam messages and 1000
messages that are not spam. The word “stock” appears in 400 spam messages and 60
messages that are not spam, and the word “undervalued” appears in 200 spam messages
and 25 messages that are not spam. Estimate the probability that an incoming message
containing both the words “stock” and “undervalued” is spam, assuming that we have
no prior knowledge about whether it is spam. Will we reject such messages as spam
when we set the threshold at 0.9?
14. Let X be the number that comes up when a fair die is rolled. What is the expected value
of X?
15. A fair coin is flipped three times. Let S be the sample space of the eight possible
outcomes, and let X be the random variable that assigns to an outcome the number of
heads in this outcome. What is the expected value of X? (6 marks)
16. What is the expected value of the sum of the numbers that appear when a pair of fair
dice is rolled? (6 marks)
17. Are the random variables X1 and X2 independent, if the sum of the numbers that appear
when a pair of fair dice is rolled? (6 marks)
18. Let X and Y be random variables that count the number of heads and the number of
tails when a coin is flipped twice. Are the random variables X and Y independent? (6
marks)
19. What is the variance of the random variable X, where X is the number that comes up
when a fair die is rolled? (6 marks)
20. What is the variance of the random variable X((I, j )) = 2i, where I is the number
appearing on the first die and j is the number appearing on the second die, when two
fair dice are rolled? (6 marks)
21. What are the quotient and remainder when −11 is divided by 3?
22. Use the definition of addition and multiplication in Zm to find 7 +11 9 and 7 ・11 9.
23. Find the prime factorization of 7007.
24. Find the greatest common divisor of 414 and 662 using the Euclidean algorithm
25. Find the greatest common divisor of 91 and 287 using the Euclidean algorithm
Page 7 of 25
𝑛(𝑛+1)
26. Show that if n is a positive integer, then 1 + 2+· · ·+n = 2
27. Use mathematical induction to prove the inequality n < 2n for all positive integers n.
28. Use mathematical induction to prove that 2n < n! for every integer n with n ≥ 4.
UNIT-IV
Questions carrying 2 marks
1. Define graph, simple graph, multigraph, pseudograph, simple directed graph, mixed
graph, loop, multi-edges with an example? (Ask any one)
2. Define degree of a vertex, with an example?
3. Define multiplicity of an edge with an example?
4. What are neighbours of a node? Give an example?
5. What are initial and terminal nodes? Give an example?
6. Define isolated and pendant nodes with an example.
7. State hand shaking theorem.
8. How many edges are there in a graph with 10 vertices each of degree six?
9. Define a complete graph with an example.
10. Define a noncomplete graph with an example.
11. Define cycle and wheel with an example.
12. Find G1 ∪ G2 for the following graph
13. Find the number of vertices, the number of edges, and the degree of each vertex in the
given undirected graph.
15. When do you say the graphs are isomorphic? Give an example.
16. Define an adjacency matrix.
17. Define an incidence matrix.
18. Define connected graph with an example.
Page 8 of 25
19. Define disconnected graph with an example.
20. Define strongly and weakly connected graph.
21. What is a Euler circuit? Give an example
22. Define Euler path with an example.
23. Define a Hamilton path. Give an example
24. Define the chromatic number of a graph
25. What is meant by colouring a graph?
26. Find the chromatic number of the given graph
1. What are the degrees and neighbourhood of the vertices in graph displayed?
2. What are the degrees and neighbourhood of the vertices in graph displayed?
Page 9 of 25
3. Find the in-degree and out degree of each vertex in the graph G with directed edges as
shown in the figure?
6. Write adjacency list and adjacency matrix to describe the simple graph given in the
figure (6 marks)
7. Represent the directed graph shown in the figure by listing all the vertices that are the
terminal vertices of edges starting at each vertex of the graph.
Page 10 of 25
9. Use an adjacency list to represent the given graph.
Page 11 of 25
16. Use an adjacency matrix to represent the pseudograph
17. Represent the graph shown in the figure with an incidence matrix
18. Represent the pseudograph shown in the figure using an incidence matrix.
19. Show that the graphs G = (V , E) and H = (W, F ), displayed in the given figure, are
isomorphic.
20. Are the graphs shown in the figure G1 and G2 connected? Verify
21. Does each of these lists of vertices form a path in the following graph? Which paths are
simple? Which are circuits? What are the lengths of those that are paths?
(a) a, e, b, c, b (b) a, e, a, d, b, c, a
(c) e, b, a, d, b, e (d) c, b, d, a, e, c
Page 12 of 25
22. Are the directed graphs G and H shown in Figure strongly connected? Are they weakly
connected?
23. Which of the undirected graphs in Figure have an Euler circuit? Of those that do not,
which have an Euler path? (any one figure)
24. Which of the directed graphs in Figure have an Euler circuit? Of those that do not,
which have an Euler path? (any one figure)
25. Which of the simple graphs in Figure have a Hamilton circuit or, if not, a Hamilton
path? (any one figure)
26. What are the chromatic numbers of the graph G and H in the figure?
Page 13 of 25
27. Construct the dual graph for the given map
29. Construct the dual graph for the map. Then find the number of colors needed to color
the map so that no two adjacent regions have the same color.
15. Construct the dual graph for the map. Then find the number of colors needed to color the
map so that no two adjacent regions have the same color.
16. How do you convert a directed tree into a binary tree? Explain with a diagram.
17. Convert the following trees into a binary tree.
Page 14 of 25
1 7
2 3 8 9 10
4 5 6 11 12 13
2 3 4 5
6 7 8 9 10 11 12
2 3 4 5
6 7 8 9 10 11
****************
Page 15 of 25
BCACACN202 -Data Structures using C
UNIT – I
Page 16 of 25
Long Answer Questions
UNIT - II
1) What is linear search? Write the algorithm for linear search. (6)
2) Explain binary search with an example. (6)
3) Write an algorithm for binary search. (6)
4) Explain any ‘2’ dynamic memory allocation functions used in ‘C’ with syntax and
example. (4)
5) Write a note on memory allocation and de-allocation function (4)
6) Write a note on dynamic memory management (4)
7) What is linked list ? Explain the different types . (6)
8) Explain the memory representation of linked list. (6)
9) Write an algorithm for traversing a linked list. (4)
10) Write an algorithm for searching an item in a linked list. (4)
11) Write an algorithm to insert an item at the beginning of a linked list. (4)
12) Write an algorithm to insert an item after a given node of a linked list. (4)
13) Write an algorithm to insert an item at the end of a linked list. (4)
14) Write an algorithm to delete the first node from the linked list. (4)
15) Write an algorithm to delete a node following a given node of a linked list. (4)
16) Write a note on two-way lists. (4)
17) Write a note on header linked list (4)
18) Explain Circular linked list. (4)
UNIT - III
Page 18 of 25
13) What do you mean by infix notation? Give an example.
14) What do you mean by prefix notation? Give an example.
15) What do you mean by postfix notation? Give an example.
16) What do you mean by polish and reverse polish notation?
17) Define queue. Name the primary queue operations.
18) Differentiate queue and circular queue.
19) What is circular queue?
20) Define dequeue. What are its types?
21) What do you mean by input-restricted deque and output-restricted deque.
22) What is meant by priority queue? What is its use?
1) Write an algorithm for PUSH and POP operations using arrays. (4)
2) Write an algorithm to push and POP operation onto a stack using linked list. (6)
3) Convert the given infix expression to prefix and postfix form.(any 2) (6)
a)A * B + ( C ^ D / E / F)
b) a / b * c – d + e / f * ( g + h)
c)( X + Y / Z * W ^ P ) –R
d) ( X + Y * Z ^ A / 4 ) – P
e) (A + B) * ( C – D) / E * F
f) a * b + ( c / d ^ e ) - f
g) ( A - B * C ^ D ) / ( E + F )
h) ( a / b ) * ( c * f + ( a – d ) * e )
i) A + B * ( C – D * ( E + F ))
j) a * b – c ^ d + e /f
4) Write an algorithm to evaluate postfix expression using stack(4)
5) Write an algorithm to convert infix to postfix expression using stack.(6)
6) Convert the following infix expression into postfix expression using
stack status. Q: (A + ( B * C – ( D / E ^ F ) * G ) *H) (6)
7) Convert the following infix expression into postfix expression using stack status.
Q: ( ( A + B ) * D ) ^ ( E – F) (6)
8) Evaluate the following postfix expression showing the stack status.
P: 3, 5, +, 6, 4, -, *, 4, 1, -, 2, ^ , + (6)
9) Evaluate the following postfix expression showing the stack status.
P: 3, 1, +, 2, ^, 7, 4, -, 2, *, +, 5,- (6)
10) Evaluate the following postfix expression showing the stack status.
P: 5, 6, 2, +, *, 1, 2, 4, /, ^ (6)
11) What is a Queue ? Explain the different types of queue. (6)
12) Write an algorithm to perform insertion operation on queue using arrays. (4)
13) Write an algorithm to perform deletion operation on queue using arrays. (4)
14) Write an algorithm to perform insertion operation on queue using linked list. (4)
15) Write an algorithm to perform deletion operation on queue using linked list (4)
16) Write an algorithm to perform insertion operation on circular queue using array (4)
17) Write an algorithm to perform deletion operation on circular queue using array (4)
18) Write a note on i) circular queue. ii)Deque. (4)
19) What is Priority queues? What are the types ?Explain (4)
Page 19 of 25
UNIT-IV
Questions carrying 2 marks:
(6)
Page 20 of 25
6) Write the preorder, inorder and postorder traversal for the given tree. (6)
7) Write the preorder ,inorder and postorder traversal for the given tree. (6)
8) Write the preorder, inorder and postorder traversal for the given tree.(6)
9) Draw the binary search tree for the following data and traverse in all 3 methods(any one )
(6)
i) 14, 15, 4, 9, 7, 18, 40, 35, 16, 13
ii) 66, 26, 22, 34, 47, 79, 48, 32, 78
iii) G , C , R , T , A , D , X , L ,P , E
10) Draw the binary tree for the given algebraic expression:
a*b–c^d+e/f
Also write preorder, inorder and postorder traversal methods for the tree. (6)
11) Draw the binary tree for the expressions given below . Also traverse in preorder ,post
order and inorder.
i)A * B + ( C ^ D / E / F)
ii) a / b * c – d + e / f * ( g + h)
iii)( X + Y / Z * W ^ P ) –R (6)
12) Draw the binary tree for the following (6)
INORDER: E, A, C, K, F, H, D, B, G
PREORDER: F, A, E, K, C, D, H, G, B
13 ) Draw the binary tree for the following inorder and postorder traversal.
INORDER: D, B, E, A, F, C, H,G
POSTORDER: D, E, B, F H, G, C, A (6)
14) Explain the method of representing the graphs using sequential method with an example. (6)
15) What is adjacency matrix and path matrix, explain with an example. (6)
16) Write an algorithm for breadth first search (BFS) for a graph. (6)
17) Write an algorithm for depth first search (DFS) for a graph. (6)
________
Page 21 of 25
BCACACN203-Object Oriented concepts using Java
UNIT I
Questions carrying 2 marks
Page 22 of 25
UNIT II
Questions carrying 2 marks
1. What is inheritance?
2. What is the purpose of keyword extends?
3. What is the purpose of super()?
4. What are abstract classes?
5. What are abstract methods?
6. How to prevent methods from overriding?
7. What are final variables?
8. What is the purpose of final class?
9. What are final methods?
10. How to define a package?
11. How to import a package?
12. List any four API packages of Java.
13. What are different methods of creating threads?
14. List different states of a thread.
15. List any four thread methods.
16. What is the purpose of notify() and notifyall() method?
17. Differentiate suspend() and stop() methods of a thread.
18. What is the purpose of resume() method?
19. What is the purpose of wait() and notify() methods?
20. What is the purpose of exception handler?
21. List any four types of exceptions in Java.
22. What is the purpose of try and catch block?
Unit IV
Questions carrying 2 marks
1. What is an Applet?
2. List two types of Applets available in Java.
3. What is the purpose of appletviewer?
Page 24 of 25
4. Write HTML file to run an applet program named Simple.
5. List any two features of Applets.
6. What is the purpose of paint() method?
7. List any four methods associated with Applets
8. What is the purpose of repaint() method?
9. Differentiate stop() and destroy() methods.
10. What is the purpose of update() method.
11. List the superclasses of Applet defined by AWT
12. List any 4 methods defined by Applet.
13. What is an event? Give example.
14. What is the purpose of Event Listener?
15. List the key features of a swing GUI
16. What happens when the constructor JButton(String msg) is called?
17. What is the purpose of setText() and getText() methods?
18. List any four swing components.
19. Differentiate Component and Container.
________
Page 25 of 25