B. Tech Previous year Question Solved Paper (2022)
Subject - Programming For Problem Solving (PPS)
Code : 100104 Full Marks : 70
Q 1. Choose the correct answer of the following .
( a ) What does the following declaration mean ?
Int *ptr [5] ;
(i) ptr is an array of pointer to 5 integers
(ii) ptr is an array of 5 integers
(iii) ptr is a pointer to an array of 5 integers
(iv) ptr is a pointer to array
ANS – (iii) ptr is a pointer to an array of 5 integer
(b) The function malloc ( ) is declared in which header file .
(i) stdio.h (ii) stdlib.h (iii) conio.h (iv) iostream.h
ANS – ( ii) < stdlib.h >
( c) #include<stdio.h>
int main( )
{
char ch = ‘ Z ‘
printf ("%d\n", ch ) ;
return 0;
}
, (1) 65 (ii.) 90 (iii) 97 (iv) 122
ANS – ( ii) 90
(d) How is an array initialized in C language?
(1) int a[3] = (1,2,3);
(ii) int a= (1,2,3);
(iii) int a[ ] = new int[3]:
(iv) int a(3)=[1,2,3];
ANS – (1) int a[3] = (1,2,3);
(e) What is the return type of the fopen( ) function in C ?
(i) Pointer to a FILE object.
(ii) Pointer to an integer.
(iii) An integer.
(iv) None of the above
ANS - (i) Pointer to a FILE object.
(F) What will be the output of the following C Code?
#include<stdio.h>
int main()
{
int x=4, y, z
y= --x:
Z=X- - ;
printf("%d%d%d", x, y, z);
}
(1) 3 2 3 (ii) 2 2 3 (iii) 3 2 2 (iv) 2 3 3
,ANS – (iv) 2 3 3
(g) The keyword used to transfer control from a function back to the
Calling function is .
(1) switch (ii) return (iii) continue (iv) go to
ANS – (ii) return
(h) #include<stdio.h>
int main()
{
Float a = 5 , b=2 ;
int c ,d:
c = a/b ;
d = c/2 ;
printf("%d", d );
return 0 ;
}
(i)1 (ii.) 0 (iii) 1.5 (iv) 1.25
ANS – (i)1
(i) In C, if you pass an array as an argument to a function, what
actually gets passwd ?
(1) First element of the array
(ii) Value of elements of the array
(iii) Base address of the array
(iv) Address of the last element of array
ANS – (iii) Base address of the array
( J ) How is the 3rd element in an array accessed based on pointer
notation
, (i) *a+3 (ii) *(a+3) (iii) *(*a+3) ( iv) &(a+3)
ANS – (ii) *(a+3)
Q 2. (a) Explain entry controlled loop and exit controlled loop with
flow - charts and examples.
ANS - Entry controlled loop (while loop) :- while loop execute the code
until condition is false .
while loop is called entry controlled loop
Syntax : -
while (condition)
{
Statements;
}
Flow charts -
Start
Cond.
Statement Stop