0% found this document useful (0 votes)
3 views

pyq_c(2017)

This document outlines a C programming examination for December 2017, lasting 3 hours and worth 70 marks. It includes compulsory questions, multiple-choice questions, and programming tasks requiring students to demonstrate their understanding of C language concepts. The exam covers topics such as data types, control structures, functions, pointers, and file handling.

Uploaded by

ranajitbarik2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

pyq_c(2017)

This document outlines a C programming examination for December 2017, lasting 3 hours and worth 70 marks. It includes compulsory questions, multiple-choice questions, and programming tasks requiring students to demonstrate their understanding of C language concepts. The exam covers topics such as data types, control structures, functions, pointers, and file handling.

Uploaded by

ranajitbarik2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

332(S)

December 2017

C PROGRAMMING

Time Allowed: 3 Hours Full Marks: 70

Answer to Question No.1 is compulsory and to be answered first.


This answer is to be made in separate loose script(s) provided for the purpose.
Maximum time allowed is 45 minutes, after which the loose answer scripts will be collected and
fresh answer scripts for answering the remaining part of the question will be provided.
On early submission of answer scripts of Question No.1,
a student will get the remaining script earlier.

Answer any five questions from the rest.

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.

the loop must be


iv) A do while loop is useful when we want that the statements within

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)).

ix) A string is terminated by a (a) \0 (b) \n (c) 0 (d)\.

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

eel ~ eaaie er C86 Ero eS ee M, eS bs


ON

j= 64/ SQUARE (4);


printf ("j > %d".j 5
}

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);

int f1(int a, int b)

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

Differentiate between formal parameters and actual parameters.


What is prototype declaration of a function?
Write a recursive function to get GCD of two numbers. Sr 215

Write the advantages of using pointers.


Explain the term dynamic memory allocation.
How are arrays related to pointers? 4+2+4

Differentiate between structure and union.


Write a program using structure to read and display the roll, name and marks of 3 subjects of a
student. 446

Distinguish between printf() and fprintf().


How does an append mode differ from a write mode in a file?
Write a program to copy the content of one file to another. 3+24+5

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

:
|

You might also like