202411041729121787

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

Sub Code: CST-001 ROLL NO……………..……………..

Ist SEMESTER EXAMINATION, 2022 – 23


I-Year, B.Tech – Common to all branch
Programming for Problem Solving
Duration: 3:00 hrs Max Marks: 100
Note: - Attempt all questions. All Questions carry equal marks. In case of any ambiguity or missing data,
the same may be assumed and state the assumption made in the answer.

Q 1. Answer any four parts of the following. 5x4=20


a) Write down any five characteristics of a good programming language.
b) Write an algorithm to sort an array of integer into descending order, where the
size of array is input by user.
c) Explain the process of compiling and running a C program. What is conditional
compilation and how does it help a programmer.
d) For a digital computer briefly explain the following:
(i.) Cache memory.
(ii.)Control unit.
(iii.)ALU.
e) Differentiate between the following:
(i.) High level language and low-level language.
(ii.) Compiler and interpreter.
f) What are the fundamental data types in ‘C’ language, mention their range, space
they occupy in memory and keyword used for their representation in writing the
program.
Q 2. Answer any four parts of the following. 5x4=20
a) Write a program in ‘C’ in which values of variables x, y, z is input by user, then
their values are rotated such that x has value of y, y has value of z, z has value of y.
b) Complete the following table regarding the operators available in ‘C’ language.

S.No Name of Operator Symbol of Operator Purpose Precedence Rank


1. Increment
2. Modulus
3. Addition
4. Logical OR
5. Assignment
operator
c)What do you mean by type conversion. Explain it by using a suitable example.
d) Compare the use of switch statement with the use of nested if-else statement.
e) Explain in detail about all the types of loops that exist in a ‘C’ programming
language?
f) Write a program in ‘C’ to print the following.
1
22
333
4444
55555
Q 3. Answer any two parts of the following. 10x2= 20
a) Explain what is likely to happen when the following situations are
encountered in a ‘C’ program.
(i.) Actual arguments are less than the formal arguments in a
function.
(ii.) Data type of one of the actual arguments does not match with
the type of the corresponding formal argument.
(iii.) The order of actual parameters in the function call is different
from the order of formal parameters in a function where all
the parameters are of the same type.
(iv.) The type of expression used in return statement does not
match with the type of the function.
b) Write a program in ‘C’ to read a (5x4) matrix using array and to calculate the
following:
(i.) Sum of the elements of the third row of the matrix.
(ii.) Sum of all the elements of the matrix.
c) What is a function? What is the meaning of prototype of a function? What is a
recursive function? Write a recursive function to calculate the factorial of a positive
integer.
Q 4. Answer any two parts of the following. 10x2= 20
a) Write a program which will read a string and rewrite it in the alphabetical order.
For example, the word PROBLEM should be written as BELMOPR.
b) What are the pointers. What is a pointer variable? Write the methods of initialization
of pointer variables? How are the pointers useful in ‘C’ programming language.
Explain the difference between const char *p and char const *p.
c) Explain with example the following:
i. Array of pointers
ii. Dynamic memory allocation
Q 5. Answer any two parts of the following. 10x2= 20
a) Define a structure called cricket that will describe the following information:
player name
team name
batting average
Using cricket, declare an array player with 50 elements and write a program to read
the information about all the 50 players and print a team-wise list containing names
of players with their batting average.
b) Write short note on the followings:
i. unions
ii. enumerations
iii. command line arguments
iv. typedef
c) Given high level I/O functions for file management in C, complete the following
table.

Sno. Function Operation Syntax of function


Name
1. fopen()
2. getc()
3. fprint()
4. putw()
5. fscanf()

**********

You might also like