Student Id: Student Name:
Odd Semester, 2018-19
Sem-In Examinations-I, Sep 2018
B. Tech. (CSE), 2018 Batch
I/IV, 1st Semester
15XXXX204: Programming for Problem Solving
Time: 2 hours Max.
Marks: 50
(Assume any missing data suitably and design adequate hypothesis, if required)
Part-A (5 X 4
M=20M)
Answer ALL Questions
(Questions must be based on fundamentals, justification etc and their applications of CO1,
CO2)
Q. No. 1, 2 from CO1 with BTL Level
Q. No 3, 4, 5 from CO2 with BTL Level
1. Explain the steps involved in solving a problem using computer.
2. Compare if-else-if and switch statement giving examples for their relevant use.
3. Is it mandatory to declare main() function with return type as void or int. What will
be the effect if there is no return type declared for main() function?.
4. Differentiate between Big-O and Big-Omega notation.
5. Is it possible to return multiple values from a function? Justify the statement with
the help of an example
Part-B (3 X
6M=18M)
Answer Question No. 6 and ANY TWO from other 3 Questions
(Practical/Application Oriented Questions with Higher BTL Covering all CO's/BTL)
6. Compulsory Question (Combination of CO1 & CO2) from important concepts.
In which header file is the NULL macro defined? State reason for your answer.
a. stdio.h
b. stddef.h
c. stdio.h and stddef.h
d. math.h
7. Identify the bug in the following function written to return the swapped values of
two integer variables given
8. Define a structure to store time with three components hours, mins and seconds.
Write a modular C program to compute the time taken by an athlete to complete a
marathon reading the start and end time of his run.
9. Does the following program do?
#include <stdio.h>
int main()
{
char ch;
int vcnt = 0, ccnt=0; for ( ch = getchar(); ch !=
‘\n’; ch=getchar()){ if(ch=='a' || ch=='e' || ch=='i'
|| ch=='o' || ch=='u' || ch=='A' || ch=='E' ||
ch=='I' || ch=='O' || ch=='U') vcnt++;
else if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
ccnt++;
}
printf( “ %d %d\n”, vcnt, ccnt);
}
Rewrite the above program using while and switch constructs.
Part-C (1 X
12M=12M)
Answer ANY ONE Question
(Question must be based on comprehensive knowledge of course)
10. Q. No. 10 from CO1+CO2 with Highest BTL Level (Open ended question compelling
High Level Thought Process)
Build a C program that reads a given integer number and checks whether it a
palindrome. A palindrome is a number that has same value even when it is reversed. Eg: 12321
is a palindrome
11. Q. No. 11 from CO1+CO2 with Highest BTL Level
Ram is conducting a study which is based on counting the number of cars crossing the
highway. Every hour he generates a random string containing sequence of characters
<rbwbwr…>, where r represents red color, w denotes white color and b denotes blue
color cars. The string is forwarded to Shyam for analysis who computes the number of
red, blue and white color cars crossing Ram every hour. Assume that Ram works for 5
hours in a day, help Shyam generate a daily report containing the following:
i. Total number of different colour cars crossing Ram in an hour.
ii. Total number of different colour cars crossing Ram in a day.
iii. iii. Total number of cars crossing Ram in a day.