Previous Year Question Papers
Previous Year Question Papers
be assumeddiagrams
DescriptivelAnalytical/Problem
must be shown
Solvino/Desien questions (attempt any 3 out
Use of
and stated
clearly. Unitswherever
following supporting of necessary. Any data you feel missing may
Ni material is quantities
permitted uscd/calculated must be stated clearly. suitably
during examination:
2 Nil
PART-A
(Basics/Fundamentals
All
questions are related questions)
a (o)
Differentiate between flowchart and algorithm.connpulsory
3
0.1 (b) What are the
valid places where the
Statement? programmer can apply Break Control 31
0.1 (c) Find the output of the
int main) following code and give reasons in support of your answer: 31
int a(5]-{10,11,13,40,50}:
int p;
p-a :;
printf("%d,",*+tp);
printf("%d",++°p):
return 0;
.1 (d) What would happen if you assign a value to an element an array whose 3
subscript exceeds the size of the array?
01 (e) How, would you use the functions fseek 0. fread), fwrite() and ftell()? Give 3
suitable examples.
PART-B
(Analytica/Numerical questions)
program in context of Intermediate code,
C [8
Q.2 (A) Explain the Compilation process in a
Executable code and Object Code.
OR
and
the basic organization of computer system, (8]
0.2 B Draw a block diagram to illustrate units.
explain the function of the various
Page 1 of2
0.3 (A)
Explain the
Q3 (B) What is thedifferent types of operators used in C with
various loopingpurposPOSe of looping OR necessary program. 18
statements in Cwvithstatesuitable
ements? Explain in detail the operation of (8]
0.4 (A) WAP that examples.
takes a
an input
from the proverbial statement (like ailures are the pillars of
user and then
statement. success.in) the (8
output the frequency of the vowels occurring
0.4 (B) Explain the OR
string manipulation library
functions with examples. [8
0.5 (A) Define
function?
an example. Explain the call by value and call by reference with
the help of 18
Q.5 (B) What are OR
pointers? How is static memory allocation different than
memory allocation? dynamic [8]
PART-C
(Descriptive/AnalyticaV/Problem Solving/Design questions)
(Attempt any 3 out of5) (Q.7 to Q.11)
Q.7 What are data Name and explain all the data types in c language with the (15]
help of examplese Aleewite thei size in hvtes & the formula by which we can
calculate the range of a given data type.
Write an algorithm and also the program to calculate the grade of a student after the (15]
Q.8
input of marks of that student.
Percentage >= 90 grade is 'A'
Percentage >= 70 grade is 'B'
Percentage >= 50 grade is C
Percentage < 50 grade is 'F"
[1s)
declaration and initialization of one and two
Q.9 What is an array? Explain the Write a C Program that will sort a
Dimensional arrays with the help of an example.
bubble sort algorithm.
given one dimensional array by using
of a number using [15)
program to calculate the factorial
Q.10 Define recursion? Write a C
recursive function.
Page 2 of2
Q.11 Detine structure in C? Write the
help of an example. Write a Cdifferences
program to between structure and array wiun u (15]
complex number using structure. perform the multiplication of two
Page 3 of2
1EO00421
B. Tech. I
Semester End-Term1E000421 Total No. of Pages: 4
Branch:
1FY3-04: Exami
Common tonall
ation (Main),
Time: 3 Hours for lBranches February-2022
Programming
Instructions to Candidates: Problem Solving
The question paper is
(i) Part-A: 7 divided in three parts A,B & C.
Maximum Marks: 105
(#
auestions
is same, Basics/Fundamentals
must be of
variable typerelated
which questions (without
have different choice).
answer Out of 77 questions, At least 2
Part-B: 5 for each student even ifif the process
the Numerical/Analytical
be of variable
type which have questions. Out of 5
remaining 3 questions have different questions.2
answer for each student questions
question. internal choice even if the(without choice) must
(ii) Part-C: 5
i.e, attempt one
guestion eitherprocess is Same a
A or B irom eacn
question
isDescriptivelAnalytical/Problem
must be of variable type which have Solving/Design questions. Out of 5
is same which
Schematic diagrams mustcompulsory and attempt any different
2 answer for each student even ifquestions,
the process
be shown questions out of remaining 4
assumed stated clearly. Units of
and wherever necessary. Any data you feel missingquestions.
IJse of following
1 Nil supporting materialquantities used/calculated must be stated clearly.may suitabiy be
is permitted during examination:
Nil
Sasics/FundanA
(Bas
srelated questions)
All questions are
compulsory
0.1 (a) Why flowchart is used before writing the
program for the given problem? (31
(b) Can an assignment operator copy one array to another? Justify your answer.
3
(c) Are the expressions *ptr ++ and ++*ptr same? Justify your answer with example. 31
(d) if 'statement can be used wherever switch statement is used" whereas vice versa 31
is not possible. Justify your answer. Write the output of the given code:
int main0
char x = 'w':
switch(x)
case 'a': printf("Append");
break;
case 'w': printf("Write");
case 'r': printf("Read");
break;
default : printf("Open");
break;
return 0;}
[3
variable of one type into another
Typecasting is used for converting the value of a Give an example where this
(e) evaluation of the expression.
type for purpose of
typecasting is useful.
Page 1 of4
(O Can we
output ofcompile
a
the program without main()
Your Roll no.given code: (where value ofa functiou?
is T21J1C is the sumlustify your
of the digitsanswer.
of yourWrte
e
int main0 CS120 then a-21+120-141) rol(e.4
int a.b:
b++a:
printf("%d,
return 0;
%d",a,b);
PART-B
(Numerica/Analytical questions)
o.2 (A) Write a program that takes in two strings SI and $2 as inputs (Sl as your first name
and S2 as your last name), reverses Sl, appends it to S2 and outputs the final string
Your program should not use any default string library function.
OR
(B) In Indian Railway ticketing system, there is no ticket requirement for kid (age<=$ 16
yrs), ticket price for child (age in between 5 yrs and 10 yrs) is half, for senior citizen
(age>60 years) ticket price is 60%.Write a C program that implements age-based
price of the ticket and will output
quota system. The program will read age and
payable price.
arithmetic expression. 16
precedence of operators in evaluation of an
0.3 (A) Justify the role of in an arithmetic expression is same, how does
When precedence of two operators
operator will be evaluated first?
the complier decide which OR Machine
and low level languages on following parameters:translation,
(B)Compare the high level maintenance of the code,
debugging and
dependency and portability,
comprehensibility.
memory efficiency and
is necessary to use
be used and where itusing Functions.
call by value can
situations where numbers
Q.4 (A) Write reference? Write a C program to swap two
call by OR
answer. What will be
Justify your
cach other?
to add pointers to
(B) Is this possiblethe C program?
the output of
#include<stdio.h>
int main(){
int m[2);
int "p=m;
m[0]=100;
m[l]-200; Page2 of4
9)
0.
Acceptafrom
Write the user
prog ran
this date,Athat cale today's date and
Performm lso, ulates the your
dry run oncalculate the number
Date ofhirh in the
that will be your program number of of minutes you format dd-mm-
generated. and lcap
stens of haveexisted
write theyears you onearthyy)
as of
witnessed til date.
Q.6 What will be the evaluation and the outpu
alphabetic
ohabetnumber
icalvalues output of the
is the
void
of
of
characters,following
characters
a 1, int your
code if
in ex if your name array a has your
is"xac" first
insert(int n) first name. Write the stepsthenof
a=[24,1 ,3name
])
as [6]
PART-C
(Descriptive/Analytical/Problem Solviug/Desigcompulsory.
n questions)
(Attempt any 2 out of 4) (Q.7 to Q.10). Q.11 is
0.7 Files can be created as a text file or as a
interms of the storage of binary file, how do the two
Write a Cprogram to readinformation and when should binary file formats differ [8+10]
name
store them in a file. If the file and marks of nnumber of studentformat be used.
from user and
previously exists, add the information of n students.
Q.9 (a) Explain any 5 String Manipulation functions with example. [6]
(b) Write aC program to perform the following:
(i) Accept a sequence of characters and special characters from the user. Special (21
characters can be any character that you find in Keyboard letters I to 0 (shift
Igivesthe!, shift
(ii) Count number2gives @..). characters in the input and display the count.
of special 3
ASCIl value.
(iii) For each character read, print the character along with itsin reverse order.
3
function print all the characters read [4
(iv) Using a recursive
are 3 subjects
test for a group of 4 students. There
Q.10 A teacher conducts a monthly Write a C program to answer the following.
marks being 10 for each. invalid input is
with maximum
valid inputs and display message if
Your program must work for all Page 4 of 4
en
() Ask the
(i) user to input marks of 3
(iiü) Computer
Grade the Average for subjects for 4 students.
students on each
all 3 subject for4
subjects as perstudents.
the following
scheme. Grade S it
(6
131
marks IS at least twice the
below the cut of
C. 'S.Gradeaverage.
B if Grade A 1t
marks is exacuymarks 1s at least
the average. averagetTGrade
a
(iv) Compute total Otherwise
marks for each student.
Q.11 (a) What is the (3
output of
#include<stdio.h> the following program? Also write the steps offevaluation. 16
int main){
int a[ ]={ }:
IInitialize
array elements with
II if name alphabetical values of vour first name.
=xac" then array a-124,131
int i,j, m;
i=tta[l];
j=a[l]+:
m =a[i++]:
printf("%d %d %d ", i,j, m):
return 0;}
(b) How can the use of pointers help in solving the
during the compilation of the program? What doeswastage or shortage of memory
the following fragment of C o0)
program print? Also write the steps of evaluation. Take your name as input string
in c.
char c[ ]="Your Name":
char "p =C,
printf("%s". p+ p[3] - p[U):
unfair
means and
1E000420
Roll No.
action shall be
taken as per
rules.
PART-A
Q.1 (a) Match the following :
(i) .xlsx [2
(i) Memory unit
(ii) TeraByte
(ii) Application software
(iii) Zoom
(iii) System software
(iv) Window 7
(iv) Excel file
(b) Write example of a programming language which supports
(c) Write output of the following code: compiler and interpreter.
int main)
inti= O:
while (1){
printf("%dn",++i);
if(í= -4)
break;
return 0;
2)
Write postfix notation of the expression: (A-B)*(C/D+E)+FI |2
(d)
You are given an integer array A[4]= {2,5,1,3}. Write a program to print 2513. [2
(e)
comparisons in Bubble
Ifn inputs are given in ascending order, then total numbers of [2)
Sort are ....
Write True/False for the following.
(g) value is modified.
(i) Call by value: The originalvariables are required to store the address of
variables. 2
(ii))Call by reference: Pointer
(h) Write recursive
G) Differentiate p function for
What is the use ofand *p withFibonacci
an series.
example.
rewindo function in C? [2
What is difference between array of structures and array within structure? Explain with
Q.6 3(A) example.
81
OR
(B Define pointer. How pointer is used in aray and structure. Write a program which
uses (i) pointer in structure and (ii) pointer in array.
PART-C
With suitable example, explain the difference between algorithm and program.
Q.7
Wite fow chat and
progrrn for"hoer search
Write program by
áven
a
umber. using switch case probie"
Example: Input:n=523 "it indvidul
Q.9 Output :Five To Three
Apply I
Insertion
bers in
numb
in sort to 2
Q10
descending order.Seqence of scendng order if yos
Show ll sseps e gven 7
What is
"factorialrecursion?
problem" byDifferertite
usinz i) reoursion d terzion
Q.11
recursion 2nd i) terion
Wte a progam to sum the list
operation elements from
(like input must be readd from a the list
from another file) flend otgt by using fileznd
musbesaved pred