Programming & Problem Solving Through Language: Total Time: 3 Hrs

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Programming & Problem Solving Through C Language

Total Time: 3 hrs Total Marks: 100

PART - ONE (Part one-40; Part two-60)

1. Each question below gives multiple choice of answer. Choose the most appropriate
one.

1.1 Which of the following software translates source code into object code?

a) Compiler b) Interpreter

c) Assembler d) Preprocessor

1.2 Which one of the following is not a keyword in C language?

a) float b) main

c) switch d) continue

1.3 For the function:

int function(int arr[ ], int n) {

……….

……….}

Which of the appropriate calling statement from main program?

a) function(arr, 6) b) r=function(arr[ ], 6)

c) a=function(arr, 6) d) p=function(int arr, 6)

1.4 Which one of the following is not a primitive data type?

a) double b) int

c) void d) long

1.5 Which one the following is not a valid relational operator?

a) >= b) =

c) < d) <=

1.6 Which of the following can’t be checked in switch case statement?

a) float b) integer

c) character d) enum
1.7 A group of same data type that call by a common name is________

a) Structure b) Union

c) Pointer d) Array

1.8 Which of the following is not a proper storage class in ‘C’?

a) auto b) extern

c) dec d) static

1.9 What will be the output of the following code segment if “LOVE YOU” is given as input?

main{

char a[10];

scanf(“%s”,a);

printf(“%s”,a);}

a) LOVE YOU b) LOVE

c) YOU d) none of these

1.10 What will be the output of the following code segment?

void fun(){

static int i=25;

printf(“%d”,++i);}

Main() {

fun();

fun();}

a) 26 27 b) 25 25

c) 26 26 d) 27 27

2. Each statement below is either TRUE or FLASE. Choose the most appropriate one.

2.1 ‘#’ is used to insert comments in the ‘C’ program.

2.2 If no storage class is mentioned for a variable defined in a function then it is by default auto.

2.3 The function return many statements.

2.4 Switch statements can be used to switch on strings.


2.5 The expressions on the both sides of a logical operator are always evaluated.

2.6 Every ‘if’ statement must also include ‘else’.

2.7 Pointer is dynamic memory allocation function.

2.8 Calloc function is used to release the memory allotted in dynamic memory allocation.

2.9 gets() is more appropriate for reading in multi-word string.

2.10 fseek function is used to change the memory size already allocated dynamically.

3. Match words and phrases in column X with the closest related meaning/ word(s)/
phrase(s) in column Y.

X Y
3.1 Structure A Loop execute at least one time

3.2 While(1) B *

3.3 ‘\0’ C Group of same data type variables called by common


name

3.4 Break D ?:

3.5 Size of void pointer E Group of same/different data type variables

3.6 Array F Print ‘\0’

3.7 Malloc() G Holds address

3.8 Indirection H Returning a pointer to the beginning of the block

3.9 Ternary I 0 byte

3.10 Pointer variable J Null character

K Infinite loop

L Terminate the loop

M 2 bytes

N ---->
4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the
list below

A 6 bytes B Ctype.h C free memory


D 2 E Extern F Stdio.h
G Global H sizeof(float) I Arbitrary
J free K 2 bytes L Logical operator
M Preprocessor N Stdlib.h O Complier
.
4.1 If *pf is a pointer to float, then ++pf will increase its value by ___________.

4.2 ________function is used to release the memory allotted in dynamic memory allocation.

4.3 ___________ are used when we want to test more than one condition and make decision.

4.4 If int n=6, then size of ‘n’ is _______.

4.5 Binary operator must have ________ operand(s).

4.6 The ________ is a program that is executed before the source code complied.

4.7 _______ keyword used to indicate global variable.

4.8 ___________ header file should be included to use malloc() function.

4.9 The function “fseek” provide a way to read or write a file in ________ order.

4.10 NULL is a macro constant which has been defined in the header file_________.

PART - TWO

5.a) Write a C program to modify the constant variable.


b) What is the difference b/w array and linked list?
c) Differentiate b/w struct and union. When is union preferred over struct over struct? Give one
example of each. (5+3+7)
6.a) Write a program which takes only integer value as a input.
b) Define a structure of student with following fields: rollno, name, marks. Write a program to read
and store the data of at most 25 students in an array. Also display the average marks of the
student. (7+8)
7.a) Write a program to count lines ,words and characters.
b) How compilation, linking and loading are related? Also explain the basic task of a compiler, linker
and loader.
c) Differentiate b/w text mode and binary mode file. (5+7+3)
8.a) Write a function which accept an array of size n containing integer values or returns average of
all values. Call the function from main program.
b) Write a program to create stack of integers using link-list and display it. (7+8)
9.a) Compute factorial of a number using recursive function.
b) Write a C program which calls a function to swap values of two variables.
c) Explain the following library functions in C – language:
i) getch
ii) getche
iii) getchar
iv) putchar
v) putch (5+5+5)

You might also like