pyq_c(2017)
pyq_c(2017)
December 2017
C PROGRAMMING
i. A. Choose the correct answer from the given alternatives (any ten): 1x10
i) C is a (a) Middle level language (b) High level language (c) Low level language (d) none
of these.
ii) If a is an integer variable, a=5/2; will return a value (a) 2.5 (b) 3 (c) 2 (d) 0.
(c) a program
iii) The break statement is used to exit from (a) an if statement (b) a for loop
(d) the main() function.
LTT
once (c) more than once (d) none of the above.
executed (a) only once (b) at least
ne
(b) the same
v) Array is a collection of (a) different data types scattered throughout memory.
+ rn
data type placed next to each other in
data type scattered throughout memory (c) the same
memory (d) different data types placed next to each other in memory.
At pinche
(arr[3])? (a) 1
vi) If an array is declared as arr[]={1,2,5,7,9}; then what is the value of size of
(b) 2 (c) 3 (d) 8.
the above.
Vii) ASCII code for a —z ranges from (a) 0 — 26 (b) 35 — 81 (¢) 97 — 123 (d) none of
EER
viii) | s1="H1”, s2="HELLO”, s3="BYE”. How can we concatenate the three strings? (a)
strcat(s1,s2,s3) (b) streat(s1,streat(s2,s3)) (c)strepy(s1,s2,s3) (d) strepy(s1,strepy(s2,s3)).
gn
The default storage class of a local variable is (a) auto (b) static (c) register (d) extern.
cai
x)
xi) *(&num) is equivalent to writing (a) &num (b) *num (c) num (d) none of these.
RE
xii) A structure can be placed within another structure is known as (a) nested structure (b) self-
referential structure (c) parallel structure (d) pointer to structure.
xiii) | From which standard stream does a C program read data? (a) stdin (b) stdout (c) stderr
(d) all of these.
a
B. What will be the output of the following codes? (any five): 5x2
a
i) #define SQUARE(n) n * n
a
main( )
{
int j;
ee
oe
ii) main()
{
int arr{]}={1,2,3,.4,5};
int *ptri;
ptr=arr+4;
for(i=0;i<5;i++)
printf("%d ",*(ptr-i));
}
iii) int func();
main()
{
printf("%d ",func());
printf("%d ",func());
printf("%d ",func());
}
int func()
{
int counter=5;
counter++;
return(counter);
}
iv) int f2(int a)
{
return(a*a);
return(f2(a*b));
} in()
int x;
x=f1(2,4);
printf("%d",x);
}
; in()
int i=1;
while(8)
{
printf("%d\n" i++);
if(i>10)
break;
}
}
: int
vi)
int x=3,y,z;
y=x=10;
z=x<10;
printf("x=%d y=%d z=%d",x,y,Z);
}
vii) main()
{
int knum=30;
k=(num>5?(num<=10?100:200):500);
printf("%d",k);
}
What do you mean by associativity property of an operator?
Differentiate between if-else if and switch statement.
Write a program to check if a character entered through keyboard is a vowel or consonant using
switch case statement. 24+3+5
Two numbers are entered through keyboard. Write a program to find the value of one number
raised to the power of another.
Differentiate between gets() and scanf().
What do you mean by scope and lifetime of a variable? Slt
What is the difference between while loop and do-while loop? Explain with example.
What is goto statement and why this should be avoided?
How is a two-dimensional array represented in memory? 5+3+2
:
|