II SEM BCA NEP - QB - Revised - Final

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

MANGALORE UNIVERSITY

COMPUTER SCIENCE TEACHERS’ ASSOCIATION


(MUCSTA)

II SEMESTER B.C.A [NEP]


2021-2022 onwards

QUESTION BANK

BCACACN201- Discrete Mathematical Structures


BCACACN202 -Data Structures using C
BCACACN203-Object Oriented concepts using Java

Page 1 of 25
BCACACN201- Discrete Mathematical Structures
UNIT -I
Questions carrying 2 marks:

1. What are logical statements? Give example.


2. Express the following compound statements in words taking p for hard work, q for
success and r for job.
i) ‫ ך‬p^‫ ך‬q ii) ‫(ך‬p˅q)^r
3. Construct the truth tables for
i) ‫( ך‬p˅q) ii) ‫( ך‬p^q)
4. Write which of these is a tautology or a fallacy.
i) p˅‫ ך‬p ii) p ^‫ ך‬p
5. Express the statement through appropriate symbols:
It is not raining still it is pleasant.
6. Define a set. Give an example.
7. Define null set and universal set.
8. Define proper subset. Give example.
9. Define disjoint sets. Give example.
10. Define subset. Give example.
11. Represent
a. A∪B b. A∩B c. A-B d. B-A e. ‫ ך‬A using Venn
diagram
12. Define power set. Give example.
13. Write the power set of A={1,2}
14. A={1,2,6,7} B={2,3,4,6,7} what is A+B?
15. A={1,2,3} B={1, 2,5,7,9} write A-B
16. A={1,2,3} B={1, 2,5,7,9}, find A+B.
17. A={2,3,4} B={1,2} and c={4, 5,6} what is (A+B )+(B+C)
18. Define Cartesian product of two sets.
19. A={a,b} B={1,2,3} write AxB and BXA.
20. Define symmetric relation and give an example.
21. Define reflexive relation. Give an example.
22. Define transitive relation. Give an example.
23. Write the power set of A={1,2,3}
24. What are equivalence relations? Give an example.
25. A={2,4,6,7,9} B={1,2,4,7,8} Find A-B and A+B.
26. A={1,2,3} B={a,b} write AXB and BXA

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. Define the terms : experiment, sample space, event.


2. An urn contains four blue balls and five red balls. What is the probability that a ball
chosen at random from the urn is blue?
3. What is the probability that when two dice are rolled, the sum of the numbers on the
two dice is 7?
4. Define Laplace’s definition of probability.
5. What is probability distribution?
6. What probabilities should we assign to the outcomes H (heads) and T (tails) when a
fair coin is flipped?
7. Define conditional probability.
8. Define independent events.
9. What is a random variable?
10. Define Bayes’ theorem.
11. Write the formula to calculate expected value.
12. What is variance?
13. Determine whether 3 | 7 and whether 3 | 12.
14. What are the quotient and remainder when 101 is divided by 11?
15. Determine whether 17 is congruent to 5 modulo 6 and whether 24 and 14 are
congruent modulo 6.
16. Define prime and composite number.
17. Define GCD and LCM.
18. What is the greatest common divisor of 24 and 36?
19. Find the prime factorization of 641 and 100
20. Find the prime factorization of 1024
21. Find the prime factorization of 999
22. What is the greatest common divisor of 17 and 22?
23. What is the least common multiple of 233572 and 2433?
24. What is the least common multiple of 17, 1717?
25. What is the gcd of 17, 1717?
26. What is Euclidean algorithm?
27. State mathematical induction?
28. What do you mean by strong induction?

Questions Carrying 4 or more 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.

14. Find isolated and pendant node in the 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

27. Find the chromatic number of the given graph

28. Define tree. Give an example


29. Define binary tree with example.
30. What is a (a) terminal node (b) degree of the node
31. What is a a) forest b) level of a node
32. Define root node and leaf node.
33. What is an ordered tree? Give an example
34. What is a binary tree? Give an example

Questions Carrying 4 or more marks.

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?

4. Find the union of the given pair of simple graphs.

5. Find the union of the given pair of simple graphs.

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.

8. Use an adjacency matrix to represent to represent the graph

Page 10 of 25
9. Use an adjacency list to represent the given graph.

10. Use an adjacency list to represent the given graph.

11. Draw a graph with the adjacency matrix

12. Draw a graph with the given adjacency matrix.

13. Represent the graph in with an adjacency matrix

14. Represent the given graph with an adjacency matrix.

15. Represent the given graph using an adjacency matrix.

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

28. 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. Find the chromatic number of the given graphs.

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

18. Convert the following tree into a binary tree


1

2 3 4 5

6 7 8 9 10 11 12

19. Convert the following tree into a binary tree


1

2 3 4 5

6 7 8 9 10 11

****************

Page 15 of 25
BCACACN202 -Data Structures using C

UNIT – I

Questions carrying 2 marks:

1. Define data structure. Give two example.


2. Write the classification of data structure.
3. Define primitive data structure. Give an example.
4. Define non-primitive data structure. Give an example.
5. Differentiate primitive data structure and non-primitive data structure.
6. Define linear data structure. Give an example.
7. Define non-linear data structure. Give an example.
8. Differentiate linear and non-linear data structure.
9. Name any 4 operations performed by data structure.
10. Define traversing and searching.
11. Define sorting and merging.
12. Write any two algorithmic notations with examples.
13. Name any 2 types of control structures used in algorithms.
14. What is a sequence logic in algorithms? Give an example.
15. What is a iteration logic in algorithms? Give an example.
16. Write the structure of single alternative.
17. Write the structure of double alternative.
18. Write the structure of multiple alternatives.
19. Define Recursion
20. Define linear array. Write the formula to obtain number of data elements in an array.
21. Consider the linear array LA(1:10). Find the number of elements in an array.
22. Consider the linear array BB(-5:10). Find the number of elements in an array.
23. Consider the linear array AA(1:10). Suppose Base(AA)=100 and w=4 words per
memory cell for AA. Find the address of AA[5].
24. Consider the linear array BB(5:50). Suppose Base(BB)=200 and w=4 words per
memory cell for BB. Find the address of BB[15],
25. Consider the linear array CC(5:50). Suppose Base(CC)=300 and w=4 words per
memory cell for CC. Find the address of CC[35]
26. Consider the two dimensional array X(5,5) . Suppose Base(X) = 100 and w=2 words
per memory cell . Find the address of X[2,3] using row major order.
27. Consider the two dimensional array X(5,5) . Suppose Base(X) = 100 and w=2 words
per memory cell . Find the address of X[2,3] using column major order.
28. Suppose a 5-element array A contains the values {25, 32, 65, 43, 78}. Find the values
of the given arrays AB[2] and AB[4] after the loop.
Repeat for K = 1 to 4:
Set AB[K + 1] := A[K]
[End of loop]
29. What is sparse matrix? Give example.
30. What is lower-triangular matrix? Give an example.
31. What is upper-triangular matrix? Give an example.
32. What is tri-diagonal matrix? Give an example.

Page 16 of 25
Long Answer Questions

1) Write the classification of data structure and explain . (6)


2) List and explain the various operations performed on data structure. (6)
3) Explain the various algorithmic notation. (6)
4) Explain selection and iteration logic in detail with example. (6)
5) What do you mean by traversing a linear array? Write the algorithm to traverse a
linear array. (6)
6) Explain the memory representation of one dimensional array (6)
7) Explain the representation of two dimensional array in memory (6)
8) Write an algorithm to inserting an element into a linear array. (4)
9) Write an algorithm to delete an element from a linear array. (4)
10) Explain sparse matrix with example. (4)
11) Write an algorithm for TOWER OF HANOI using recursion with example (6)
12) Trace the following numbers using bubble sort for the following data:
65, 25, 10 , 80 , 25 , 11 , 45,20 (6)
13) Trace the following list of numbers using insertion sort technique:
23, 45, 56 22, 10, 27, 33, 48, 39,55,88,90 (6)
14) Trace the following list of numbers using selection sort technique:
77, 33, 44, 11, 88, 22, 66, 55 (6)
15) Trace the following numbers using merge sort for the following data:
65, 25, 10 , 80 , 25 , 11 , 45,20 (6)
16) Trace the following list of numbers using Quick sort technique:
77, 33, 44, 11, 88, 22,66 ,55 (6)
17) Explain bubble sort with an example. (6)
18) Explain insertion sort with an example. (6)
19) Explain Selection sort with an example. (6)
20) Explain Merge sort with an example. (6)
21) Explain quick sort with an example.
22) Write an algorithm for Bubble sort. (6)
23) Write an algorithm for Selection sort. (6)
24) Write an algorithm for Insertion sort. (6)
25) Write an algorithm for quick sort (6)

UNIT - II

Questions carrying 2 marks:


1. Define searching. Name 2 types of searching techniques.
2. What is the difference between linear and binary search?
3. Write one advantage and disadvantage of binary search.
4. What do you mean by dynamic memory allocation? Write any 2 functions used in ‘C’
for dynamic memory allocation.
5. What is linkedlist?
6. What is free storage list?
7. What is garbage collection?
Page 17 of 25
8. What role does the AVAIL list play in a linkedlist?
9. How is singly linked list terminated? Give diagram.
10. Define circularly linked list. Give its diagram.
11. What is two-way list? Give its diagram.
12. What is doubly linked list? Give its diagram.
13. Write the node diagram of two-way list.
14. What is underflow and overflow with respect to linked list?
15. Write the advantages of linked list over arrays.

Long Answer Questions

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

Questions carrying 2 marks:

1) What is stack? Name the basic operations performed on stack.


2) What is LIFO list? Mention any 2 its applications.
3) Mention any two applications of stack.
4) What do you mean by PUSH and POP operation?
5) Expand LIFO and FIFO.
6) What is a queue? Why queue is called FIFO list?
7) How does Stack differ from Queue?
8) Write an algorithm for PUSH operation using arrays.
9) Write an algorithm for POP operation using arrays.
10) Write an algorithm to find factorial of a number N using recursion.
11) Write an algorithm to generate Fibonacci series using recursion.
12) Define i) infix notation ii) prefix notation iii) postfix notation.

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?

Long Answer Questions

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:

1) Define binary tree. Give an example.


2) Define the terms with respect to tree. (Any 2)
i) parent ii) left child iii) right child iv) siblings v) descendent vi) ancestor vii) edge
viii) path ix) leaf node x)terminal node xi)branch xii) depth of a tree
3) Define complete binary tree. Give an example.
4) What is extended binary tree? Give an example.
5) What do you mean by internal nodes and external nodes?
6) If a node N occupies TREE [4], then in which the locations left child and right child
are stored?
7) What is a binary search tree? Give an example.
8) Give any two applications of binary tree.
9) What is Graph? Give an example.
10) Define the terms (any two) with respect to graph.
i) adjacent node ii) directed edge iii) undirected edge iv) directed graph
v) undirected graph
11) Define adjacency matrix.
12) Define path matrix.

Long Answer Questions

1) Define the terms with respect to tree. (Any 4)


i) parent ii) left child iii) rightchild iv) siblings v) descendent vi) ancestor vii) edge viii)
path ix) leaf node x) terminal node xi) branch xii) depth of a tree (4)
2) Write a note on i) Complete binary tree ii) Extended binarytree (6)
3) With an example, explain sequential representation of binary tree. (6)
4) What are the 3 standard ways of traversing a tree T with root R. write steps of each
traversal using recursion. (6)
5) Write the preorder, inorder and postorder traversal for the given tree.

(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

1. What is Object Oriented Programming?


2. Define the terms i) Data Encapsulation ii) Data Abstraction
3. What do you mean by data hiding ?
4. What is Polymorphism? Give example
5. What is dynamic binding?
6. Mention any four advantages of OOP.
7. Mention any four application areas of OOP.
8. List any four features of Java
9. What is Java Bytecode?
10. What is Java Virtual Machine ?
11. Write the meaning of public static void main(String args[])
12. Mention two ways of writing comments in Java
13. List any 4 primitive data types available in Java.
14. What is the difference between 10.3 and 10.3f?
15. What are the two ways of initializing variables?
16. What is dynamic initialization of variables? Give example.
17. List different arithmetic operators available in Java
18. What is type conversion? What are its types?
19. What is automatic (implicit) type conversion? Give example
20. Write the meaning of System.out.println()
21. Write a single print statement to produce the following output
a. ONE
b. TWO
c. THREE
22. What is stream? List different types of streams in Java.
23. Differentiate byte and character streams.
24. List the predefined streams of system object
25. Write the syntax of simple if statement with example.
26. Write the syntax of switch statement.
27. Give the syntax of declaring a symbolic constant with example.

Questions carrying 4 or more marks


1. Explain various features of OOP.
2. Write a note on application and benefits of OOP.
3. List and explain different features of Java
4. Explain a simple java program with example.
5. Explain the java program structure with example.
6. What are identifiers? Write the rules to be followed when creating an identifier.
7. List and explain different primitive data types available in Java.
8. Explain automatic type conversion with suitable code example.
9. Explain explicit type conversion with example.
10. What are streams? List and explain different byte and character streams
11. Explain the relational and logical operators with example.
12. Explain the increment , decrement and conditional operator with syntax and example.
13. Explain the process of reading a character from the keyboard with suitable example.
14. Explain different forms of if statement with syntax and example
15. Explain switch statement with syntax and example

Page 22 of 25
UNIT II
Questions carrying 2 marks

1. What is the purpose of break and continue statement ? Give example.


2. Write the for statement for a loop that counts from 1000 to 0 by -2
3. Write a for loop to display even numbers between 1 and 100
4. What are arrays?
5. How to create and instantiate a one dimensional array? Give example
6. How to initialize an array at the time of creation? Give example.
7. What is the use of length member of arrays?
8. How to create and instantiate a two dimensional array? Give example
9. What are different ways of constructing String? Give example.
10. List any four methods associated with Strings.
11. What is vector? How it is different from array?
12. What are classes and objects?
13. What is the purpose of new operator?
14. Write the syntax to create a class in Java.
15. Write a statement that creates and instantiates an object in Java.
16. What are constructors? What is the purpose of a constructor?
17. What is the use of this keyword in java?
18. List any two restrictions of static methods.

Questions carrying 4 or more marks


1. Explain for loop with syntax and example.
2. Explain any three forms of for loop with suitable example.
3. Explain while loop with syntax and example
4. Explain do while loop with syntax and example.
5. Explain break and continue statement with suitable example.
6. Write a note on Labelled loops.
7. Explain the use of for each style of loop with suitable code example.
8. What are arrays? Explain how to declare instantiate initialize and use a one-
dimensional array with suitable code example.
9. Explain different methods to initialize an array with suitable example.
10. Explain any four string methods with suitable example.
11. Explain any five vector methods with code example.
12. Explain the wrapper class methods String() , valueOf() and parsing methods with
syntax and example.
13. Write the general form of a class? Explain how to define a class in Java with suitable
example.
14. Explain how to create an object in Java with suitable example.
15. Explain the use of Constructors with suitable example.
16. Explain command line arguments in Java with example.
17. Explain how to pass objects to methods with suitable example.
18. Explain how to return an object from a method with suitable example
19. Explain method overloading with suitable example.
20. What is recursion? Illustrate recursion with a code example.
21. Explain static variable and methods with suitable example.
22. Create a class Student with members Register number, name and marks in three
subjects. Use constructors to initialize objects and write a method that displays the
information of a student.
23. Explain constructor overloading with suitable example.
24. Explain how to pass variable-length arguments with suitable example.
Page 23 of 25
UNIT III
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?

Questions carrying 4 or more marks

1. Explain single inheritance with suitable example.


2. Explain method overriding with suitable example.
3. Explain multi-level inheritance with suitable example.
4. Explain the purpose abstract and final classes.
5. Explain how to create and use a package in Java with suitable example.
6. List and explain different API packages available in Java.
7. Explain how to create and implement interface using suitable example.
8. Explain the process of creating a thread by Extended Thread class.
9. Explain the process of creating a thread by implementing Runnable interface with
suitable example.
10. List and explain any five thread methods
11. Explain the life cycle of a Thread with diagram.
12. Explain exception handling in Java with suitable example.
13. Illustrate the use of multiple catch statements with suitable example.
14. Illustrate the use of finally with suitable example.
15. List and explain any 5 built-in exceptions of Java

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.

Questions carrying 4 or more marks

1. Write the complete Applet skeleton with example.


2. List and explain any 6 methods defined by Applet
3. List and explain the components of Delegation Event Model
4. List and explain any three Event Listener Interfaces
5. Explain how any two Mouse events are handled in Applets with suitable example
6. Explain how any two Key events are handled in Applets with suitable example
7. With example explain creating frame window in applet.
8. Explain the purpose of JButton and explain any four methods associated with it.
9. Explain the use of JTextField and any four methods associate with it
10. Explain the use of JList and any for methods associated with it.
11. Illustrate the use of ILabel with suitable example.
12. List and explain different methods associated with JCheckBox.
13. Explain the use of JCombobox and any for methods associated with it.
14. Explain different methods associate with JRadioButton control with suitable example.
15. Explain with example creating a Frame window in Applet.
16. Write a note on Swing Components and Containers.
17. Write and explain a simple swing application program.

________

Page 25 of 25

You might also like