Computer Science and Engineering
Computer Science and Engineering
PART A
Answer all questions. Each question carries 3 marks CO Marks
1 The p.m.f. of the amount of memory X (GB) in a purchased (3)
flash drive is given.
x 1 2 4 8 16
P(x) .05 .10 .35 .40 .10
Find the mean and Variance
2 8 Coins are tossed 256 times. In how many tosses do you expect no heads ? (3)
3 The mileage which car owners get with a certain kind of radial tire is a (3)
random variable having an exponential distribution with mean 40000 km.
Find the probability that one of these tires will last at least 20000 km.
4 If 𝑋 follows 𝑁(3,2), find the value of 𝑘 such that 𝑃(|𝑋 − 3| > 𝑘) = 0.05 (3)
5 Suppose we know that the number of items produced in a factory (3)
during a week is a random variable with mean 500. If the variance of a
week’s production is known to equal 100, then what can be said about the
probability that this week’s production will be between 400 and 600?
6 Classify stochastic processes with examples. (3)
7 Whether or not it rains follows a 2 state Markov chain. If it rains one day, (3)
then it will rain the next with probability 1/2 or will be dry with probability
1/2. Overall, 40 percent of days are rainy. If it is raining on Monday, find the
probability that it will rain on Thursday.
8 J plays a new game every day. If J wins a game, then she wins the next one (3)
with probability 0.6; if she has lost the last game but won the one preceding
it, then she wins the next with probability 0.7; if she has lost the last 2
games, then she wins the next with probability 0.2. What proportion of
games does J win?
PART B
Answer any one full question from each module. Each question carries 9 marks
Module 1
9 a) Suppose that the number of drivers who travel between a particular origin (4)
and destination during a designated time period has a Poisson distribution
with parameter 𝜇 = 20. What is the probability that the number of drivers
will be at most 3 ?
b) If the joint probability density function of random variables of 𝑋 and 𝑌 is (5)
given by 𝑓(𝑥, 𝑦) = 𝑐(2𝑥 + 3𝑦), 𝑥 = 0,1,2; 𝑦 = 1,2,3. Find (i) the value of
𝑐 (ii) the marginal probability distributions of 𝑋 and 𝑌 (iii) the probability
distribution of 𝑋 + 𝑌.
10 a) If 6 of 18 new buildings in a city violate the building code, what is the (4)
probability that a building inspector, who randomly selects 4 of the new
buildings, will catch (i) none (ii) exactly one of the new buildings that
violate the building code?
b) A random variable 𝑋 takes values -3, -2, -1, 0, 1, 2, 3 such that (5)
𝑃(𝑋 = 0) = 𝑃(𝑋 > 0) = 𝑃(𝑋 < 0) and 𝑃(𝑋 = −3) = 𝑃(𝑋 = −2) =
𝑃(𝑋 = −1) = 𝑃(𝑋 = 1) = 𝑃(𝑋 = 2) = 𝑃(𝑋 = 3).
Obtain the probability mass function and distribution function of 𝑋.
Module 2
11 a) Buses arrive at a specified stop at 15 min intervals starting at 7 am, that is (4)
they arrive at 7, 7:15, 7:30, 7:45 and so on. If a passenger arrives at the stop
at a random time that is uniformly distributed between 7 and 7:30 am, find
the probability that he waits (i) less than 5 min for a bus (ii) at least 12 min
for a bus.
b) The joint pdf of a two-dimensional random variable (𝑋, 𝑌) is given by (5)
𝑘(6 − 𝑥 − 𝑦); 0 < 𝑥 < 2, 2 < 𝑦 < 4
𝑓(𝑥, 𝑦) =
0; 𝑒𝑙𝑠𝑒𝑤ℎ𝑒𝑟𝑒
Find (i) the value of 𝑘, (ii) 𝑃(𝑋 < 1, 𝑌 < 3) , (iii) 𝑃(𝑋 + 𝑌 < 3)
12 a) Let 𝑋 follows exponential distribution with pdf (4)
1 /
𝑓(𝑥) = 5 𝑒 , 𝑥>0
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Evaluate (i) 𝐸(𝑋) (ii) 𝐸(𝑌) (iii) 𝑃(𝑋 + 𝑌 ≥ 1)
b) Suppose the Rockwell hardness of a particular alloy is normally distributed (5)
with mean 70 and standard deviation 3. If a specimen is acceptable only if its
hardness is between 67 and 75, what is the probability that a randomly
chosen specimen has an acceptable hardness?
Module 3
13 a) Suppose that people immigrate into a territory according to a Poisson (5)
process with rate λ = 2 per day.
(a) Find the probability there are 10 arrivals in the following week (of 7
days).
(b) Find the expected number of days until there have been 20 arrivals.
b) The lifetime of a special type of battery is a random variable with mean 40 (4)
hours and standard deviation 20 hours. A battery is used until it fails, at
which point it is replaced by a new one. Assuming a stockpile of 25 such
batteries, the lifetimes of which are independent, approximate the probability
that over 1100 hours of use can be obtained.
14 a) If people arrive at a book stall in accordance with a Poisson process with (6)
mean rate of 3 per minute, find the probability that the interval between 2
consecutive arrivals is
(i) more than 1 minute
(ii) between 1 minute and 2 minutes
(iii) 4 minutes or less.
Part A
Answer all questions. Each question carries 3 marks. CO Marks
1 When you google something, the search engine essentially per- 1 (3)
forms pattern matching: it identifies and retrieves web pages
containing the search keyword(s), then displays them in a pre-
determined (typically relevance-based) order. Cast this pat-
tern matching as a decision problem. Also write down the
language corresponding to your decision problem.
2 Construct a DFA for the language consisting of strings over 2 (3)
the alphabet Σ = {a, b} that contains no more than one oc-
currence of the string aa. (Note that the string aaa contains
two occurrences of aa.)
3 Is the class of languages recognized by NFAs closed under 1 (3)
complement? Explain your answer.
4 Give a context-free grammar that generates the language: 3 (3)
S → aA
A → aABC | bB | a
B→b
C→c
2. Does M accept ε?
Module I
9 (a) Eliminate ε-transitions from the ε-NFA defined by: 2 (4)
δ(q0 , a) = {q0 , q1 }
δ(q1 , b) = {q1 , q2 }
δ(q2 , a) = {q2 }
δ(q1 , ε) = {q1 , q2 }
a a, b a, b a, b
q0 q1 q2 q3 q4
Page 2
11 (a) Prove that the class of regular languages is closed under sub- 1 (4)
traction. That is, show that if L1 and L2 are regular languages
over some alphabet Σ, then the language
L1 − L2 = {w ∈ Σ∗ | w ∈ L1 and w ∈
/ L2 }
is also regular.
(b) Let Σ = {1, ≥} and consider the language 1 (5)
12 (a) Let Σ = {(, )} and let P be the language consisting of all 1 (5)
strings of properly nested parentheses. For example, P con-
tains the strings:
but not:
")(", "(((("
(b) Find a regular expression that denotes all bit strings whose 2 (4)
value, when interpreted as a binary integer, is greater than or
equal to 33.
Module III
13 (a) Convert the following CFG into Chomsky normal form: 3 (5)
S → SAB | AB | SBC
A → AB | a
B → BAB | b
C→b
Page 3
(b) Construct a PDA for the language 3 (4)
X → aX | Y | b
Y → bK | K | b
K→a
L = {w ∈ Σ∗ | w is a palindrome}.
Page 4
MODEL QUESTION PAPER
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
THIRD SEMESTER B. TECH DEGREE EXAMINATION, MONTH AND YEAR
PART A
Answer all questions. Each question carries 3 marks CO Marks
1 What is the time complexity of this algorithm? CO1 (3)
J=1
for (I=1; I<n; I++)
while j<I
j=j*2
2 What is row-major and column-major memory layouts? How do they apply CO1 (3)
to 2D array storage?
3 Compare the insertion at head and tail in singly linked list and doubly linked CO2 (3)
list
4 Write an algorithm to count the number of occurrences of a word in a linked CO2 (3)
list (each node contains only one word)
5 Compare array and linked list in terms of memory usage and CO3 (3)
insertion/deletion complexity
6 Draw the binary tree whose sequential representation is given below CO3 (3)
1 2 3 4 5 6 7 8 9 10 1 12 1 14 15
1 3
A B C - D E - - - - - F G - -
7 Let the size of a hash table is 8. The index of the hash table varies from 0 to CO4 (3)
7. Assume the keys 73, 54, 15, 48, 89, 66, 37, 18, are mapped using modulo
operator. Show how the keys are distributed using hashing
8 Apply the Quick Sort algorithm (using the last element as the pivot) to sort CO4 (3)
the following list of numbers: [8,4,7,3,10]
PART B
Answer any one full question from each module. Each question carries 9 marks
Module 1
9 a) Illustrate how an algorithm's time and space complexity can be explained CO1 (5)
using tables and graphs.
b Write an algorithm to implement a circular queue using array. CO1 (4)
)
Page 1of 3
10 a) Write an algorithm for push and pop stack operation using arrays. CO1 (5)
b Compare priority queues and deques in terms of structure, use cases, and CO1 (4)
) operations.
Module 2
11 a) Evaluate the given expression using stack 4*5/3-(4%2) +(1*5)-2 CO2 (5)
b Write algorithms to insert and delete elements from a double ended queue. CO2 (4)
)
12 a) Write a program using linked lists to solve (5)
b Given a singly linked list, write an algorithm to insert a node at the CO2 (4)
) beginning and end of a singly linked list.
Module 3
13 a) The Breadth-First Search algorithm has been implemented with the help of a CO3 (4)
queue. What is a possible order of visiting the nodes of the following graph
is
Page 2of 3
b Construct the binary search tree with: 52, 35, 11, 7, 10, 90, 21, 16. What is CO3 (4)
) the height of the created tree?
Module 4
15 a) You are given a hash table with 5 buckets (i.e., indices 0 to 4). Use open CO4 (4)
hashing (separate chaining) to insert the following set of keys:
{12,42,22,52,32}. Use the division method in hashing.
b Create a text file that contains the names and marks of students in a class. CO4 (5)
) Then, read the data from the file, apply the Quick Sort algorithm to sort the
students based on their marks in decreasing order, and store the sorted data
back into a file.
16 a) You are given k sorted linked lists. Your task is to merge them into one CO4 (6)
sorted list. Use a min-heap (priority queue) to optimize the merging process.
Always insert the smallest available element into the result list by extracting
it from the heap and then pushing the next element from the same source list,
if it exists.
b Implement a spell checker that uses a hash table to store a dictionary of valid CO4 (3)
) words, enabling fast lookup to detect and flag misspelled words in a given
input text.
*****
Page 3of 3
MODEL QUESTION PAPER
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
THIRD SEMESTER B. TECH DEGREE EXAMINATION, MONTH AND YEAR
Course Code: PBCST304
Course Name: Object Oriented Programming
Max. Marks: 40 Duration: 2 hours 30 minutes
PART A
1 You compile [Link] on Windows into [Link], then copy that CO1 (2)
same [Link] file to both a Linux machine and a macOS system.
Without recompiling, you run:
java MyApp
on each machine, and it executes successfully.
What is the name of the compiled file format that makes this possible?
2 What will be the value of a after the execution of the following code CO1 (2)
segment in Java.
int a = -1;
a = a >> 4;
3 You’re given this Java code: CO2 (2)
class Vehicle {
protected String type = "Generic Vehicle";
Vehicle() {
[Link]("Vehicle created");
}
}
class Car extends Vehicle {
protected String type = "Car";
Car() {
// **INSERT STATEMENT A HERE**
[Link]("Type: " + type);
}
void printParentType() {
[Link]("Parent Type: " +
Page 1 of 5
[Link]);
}
}
public class TestSuper {
public static void main(String[] args) {
Car c = new Car();
[Link]();
}
}
a. What exact statement must replace // **INSERT STATEMENT A
HERE** so that when you run TestSuper, you see:
Vehicle created
Type: Car
Parent Type: Generic Vehicle
b. In one sentence each, explain:
(i) What the statement you inserted does here.
(ii) Why [Link] prints "Generic Vehicle" while type prints "Car".
4 Illustrate inheritance in Java. CO2 (2)
5 Using proper examples, give the difference between interfaces and abstract CO3 (2)
classes in Java.
1 import [Link].*;
2 public class ExceptionDemo {
3 public static int divide(int a, int b) {
4 return a / b;
5 }
6 public static void readFile(String path) throws
IOException {
7 FileInputStream fis = new FileInputStream(path);
8 [Link]();
9 }
10 public static void main(String[] args) {
11 String filePath = args[0];
12 int x = [Link](args[1]);
13 int y = [Link](args[2]);
Page 2 of 5
14 try {
15 readFile(filePath);
16 [Link]("Result: " + divide(x,
y));
17 } catch (Exception e) {
18 [Link]();
19 }
20 }
21 }
Answer any one full question from each module. Each question carries 6 marks
Module 1
9 a) Write a Java program that uses command line arguments to calculate area: CO1 (4)
If the user enters one argument, the program should treat it as the side
of a square and print the area of the square.
If the user enters two arguments, the program should treat them as the
length and breadth of a rectangle and print the area of the rectangle.
If the number of arguments is not 1 or 2, display an appropriate error
message.
b) Illustrate the use of this keyword in Java. CO2 (2)
10 a) Design a Java class Book with the following attributes: title, author, and CO2 (4)
price.
Write a parameterized constructor to initialize these values.
Also write a default constructor that sets default values.
Create a display() method to print the book details.
In the main method, create two objects — one using the default
constructor and another using the parameterized constructor — and
display their details.
Page 3 of 5
b) Refactor the Book class so that (i) data validation and (ii) input/output each CO1 (2)
live in their own classes. Which SOLID principle are you applying, and
why?
Module 2
11 a) Create a Java class Calculator that demonstrates method overloading by CO2 (3)
implementing the add() method in the following ways:
add(int a, int b) — returns the sum of two integers.
add(double a, double b) — returns the sum of two double values.
add(int a, int b, int c) — returns the sum of three integers.
In the main method, create an object of Calculator and call all the overloaded
add() methods with appropriate arguments. Display the results.
b) Create a Java class Counter that has a static variable count to keep track of CO2 (3)
the number of objects created. Increment count in the constructor. In the
main method, create three objects of the Counter class and display the total
number of objects created using the static variable.
12 Define a Java base class Animal with a method makeSound() that prints a CO2 (3)
generic sound. Then, create two subclasses Dog and Cat that override the
makeSound() method to print "Bark" and "Meow" respectively. In the main
method, create objects of Dog and Cat and call the makeSound() method to
show runtime polymorphism.
Module 3
15 Design a simple Java Swing GUI application with the following features: CO5 (6)
A window with two buttons labeled “Greet” and “Clear”.
A text field where the user can enter their name.
When the “Greet” button is clicked, display “Hello, [Name]!” in a
label.
When the “Clear” button is clicked, clear the text field and the label.
Use appropriate event handling by implementing ActionListener and
demonstrate how to register and handle events in Java Swing.
In your Swing GUI, the user enters a name and clicks ‘Save’. Write the
Page 4 of 5
JDBC code to insert that name into table greetings(name VARCHAR),
handling exceptions appropriately.
Write the complete code for this application.
16 a) Draw an MVC diagram for this Swing+JDBC app. CO5 (3)
b) Describe how you’d apply Dependency Inversion so the Controller can be CO5 (3)
unit-tested without a real database.
*****
Page 5 of 5
MODEL QUESTION PAPER
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
PART A
1 Realize the Boolean expression F=A’BC+A’B’+BC using NOR gates alone. (3)
2 A weather monitoring station records the temperature as 8-bit signed integer (3)
using twos complement representation. If the current temperature is -5
degrees, obtain its two's complement representation. If the temperature
increases by 12 degrees, obtain the new temperature after performing the
binary addition using two's complement method.
3 You are given a task to design an industrial press machine’s safety system. (3)
The press will operate (output F=1) only under the following safe
conditions.
Create the truth table describing the output F, based on the inputs M,E,A,B.
Deduce the simplified Boolean expression in SOP form for the security
system
4 Design a 3 bit code converter circuit with a mode control bit ‘M’, which (3)
converts the input binary code to gray code when M=0, and a gray code to
Page 1of 5
its equivalent binary code when M=1. Draw the logic diagram.
5 Design and realize an 8:1 multiplexer using two 4:1 multiplexers with (3)
necessary truth tables and explanations.
7 Derive the characteristic table, characteristic equation, and excitation table (3)
for a JK flipflop
PART B
Answer any one full question from each module. Each question carries 9 marks
Module 1
b) (4)
A logic circuit family has all its gates (NAND, INVERTER, NOR)working
with the following DC specifications:
Determine the Noise Margin Low and Noise Margin High for this circuit
family.
1 a) Compute 6410 − 10010 using 8-bit two’s complement addition. Provide the (4)
8-bit result and indicate whether two’s complement overflow occurred.
Page 2of 5
0 Check your result by converting the 8-bit result back to decimal.
b) (5)
You are using an 8-bit signed fixed-point number system with a Q3.4
format (3 integer bits, 4 fractional bits, 1 sign bit).
Module 2
1 a) (6)
1
(i) For the given combinational circuit, determine the logic expression for F.
(iii) Deduce and realize the circuit using NOR gates only.
(iv). Deduce and realize the circuit using NAND gates only.
number of literals and draw the logic diagrams of the circuits that
implement the simplified expressions
Page 3of 5
1 a) Using K-map reduction obtain the minimized sum of products (SOP) (6)
2 expression for F=m(1,3,9,11)+d(0,4,5). Also obtain the POS expression for
F
b) Write the verilog module for realizing the SOP and POS expressions for F (3)
in above question using using the conditional operator (?) in dataflow
model.
Module 3
1 a) Design and realize a full adder circuit using two half adders. ()
3
b) Write the complete verilog module for a 2:1 multiplexer using the ()
conditional operator (?) in dataflow model. The module should have two
data input ‘in0’, ‘in1’, and one selection input ‘sel’ and one output ‘out’.
c) ()
(i). an 8:1 multiplexer, assuming that the multiplexer works with logic low
enable input and produces logic low outputs
(ii) 1:16 demultiplexer, assuming that the demultiplexer works with logic
low enable input and produces logic low outputs.
b) Design a simple digital circuit that implements a 4 bit unsigned adder with ()
an overflow indicator. The design should adhere to the modern digital
design flow using Verilog HDL emphasizing good abstraction.
Module 4
b) Write the behavioural Verilog code to implement a negative edge triggered (5)
D flipflop and hence develop the behavioural model to implement a 4 bit
synchronous up counter by instantiating the D flipflop.
Page 4of 5
1 a) Design a mod 10 synchronous counter using JK flipflop. Draw the the (6)
6 circuit and its timing diagram.
b) Design and develop the logic diagram to convert a D flipflop into a JK (3)
flipflop.
*****
Page 5of 5