CP Question Paper
CP Question Paper
PUDUCHERRY
SECOND SEMESTER
CS 201- Programming for Problem Solving
Time: Three Hours Max. Marks: 60
PartA - Answer ALL Questions. 5 x 2 = 10 Marks
No. Question
i. Outline the building blocks of algorithms
ii.
What are unary operators? List the unary operators in C language.
Show the output of the program
#include<stdio.h>
void main(){
lii.
int i, x[5] = {10, 20, 30, 40, 50}
for(i = 0; i < 5; i4+)
printf("%d" x[i]+i[x]); }
iv. Distinguish between structure and union.
v. Compare macro and function in C language
Part B - Answer ALL Questions. 5x8 Marks
No Question Marks
1. What is software? Explain the classificationsof software in detail. 5
b. What •is pseuocode? Write pseudo code to find the roots of the quadratic 3
equation.
OR
2. a. Explain the functional components and their interactions of a digital 5
computer with block diagram.
b. Compare the features of first, second and third generation programming 3
languages.
7. a. What is the purpose of the typedeffeature and how is this feature used in
structure declaration? 3
9.
Explain various functions for dynamic memory allocation in C language. 5
Outline various file modes in C language. 3
OR
10 a. What is conditional compilation? Illusyate complier control directives with 4
suitable example—
b. What are command line arguments?Write C program to find the minimum
of three integer number using command line arguments. 4
No Question Marks
ll. List various functions in C language for file operations. 2
b. Develop C program for the following: 8
Declare a structure which will contain the following details about the
faculty of a technological university:
Faculty hame, id, department, designation, specialization and
length of
service. Using this structure store details about N number of
faculty in a
file named "Faculty.dat".
Use the above file and list all the faculty of the given
department.
OR
12. a.
What is the relationship between pointers and arrays in C?
2
b. Develop C program for the following:
Create a structure called "time" with three integer
members hours, minutes
and seconds. Define a function called "add time"
to add two time values
stored in the time structures passed by reference
and return a time structure 8
corresponding to the result. i.e addition of two given times.
Call the
add_time function in the main function and display
result along with
given input time values. the