Comp Science I April 2022
Comp Science I April 2022
(a) Write a program in C/C++ that calculates the standard deviation of the given dataset: 10, 12, 44, 30, and
24. (8)
(b) Write a C++ program that takes input two numbers and implements the NAND gate. Why is a NAND
gate a vital concept in digital logic design? (8)
(c) What is the difference between a compiler and an interpreter? (4)
Question 4
(a) Procedural programming was a key concept in early computer science, why did it evolve into OOP over
time? (10)
(b) What is exception handling? Explain. (4)
(c) Define a function named monthly-profit which will calculate the monthly profit on the given investment
amount. Function will take two float arguments, percent profit rate and investment amount and return the
monthly profit (float). Write function prototype, function definition and a main program to demonstrate the
functionality. Sample execution of the program is given below. User can enter any values therefore write
generalized function (user variables, not given values).
Enter percent profit rate: 8
(a) What is the difference between big O, big omega and big theta? Explain in terms of algorithm analysis
and how we can judge an algorithm based on measuring these three quantities. (10)
(b) Explain the usefulness of hash tables? (5)
(c) What is a genetic algorithm? (5)
Section B
Question 6
Question 7
(a) Write similarities and differences of CFG and regular expression. (6)
(b) What are the different phases of compilers? (6)
(c) What is the difference between a top-down and bottom-up parser? (8)
Question 8
(a) Explain the difference between iterative and incremental development in software engineering. (8)
(b) Why have most software development companies shifted to agile methodology. (6)
(c) Why is waterfall process model being phased out? (6)
***************
Best of Luck for CSS-2022