CS100 QP
CS100 QP
CS100 QP
Page 1 of 3
01000CS100092001
12 Given, fp is a file pointer pointing to a text file opened in read mode. Write the (3)
fseek() for moving the file pointer (fp) to :
(i) the last charater in the file (NOT the end of file).
(ii) move to the beginning of the file.
(iii) move to the just previous character.
13 Write the syntax of fwrite() function and point out what are the arguments. (2)
14 Suppose a is an unsigned integer variable whose value is 0x5978. What will be (2)
the value of b, after executing the statement, b = a << 5;
(Give the value of b in hexadecimal form.)
PART B
Answer any four questions. Each question carries 8 Marks
15 Write the syntax and explain the working of different iterative statements in C (8)
language.
16 a) Write a program for finding the largest element in a MxN matrix of integer (5)
numbers. Display the largest number and its position.
b) Write a program to count the digits in a string. (3)
17 a) Suppose S is a structure variable, SP is a pointer to structre and is pointing to S (3)
and m is a member of structure. Write the two different expressions in C
language for accessing the member m using SP.
b) Define a function, using pointers, for concatenating two strings passed to it. (5)
Second string is concatenated to the first one. Do not use any library functions.
18 Write a function for checking whether a counting number is prime or not. Using (8)
this function write a program for displaying the prime numbers in first N
counting numers.
19 a) Write a C program for finding the smallest of N integer numbers. (4)
b) Write a recursive function for finding the kth fibonacci number. Fibonacci (4)
series is 1, 1, 2, 3, 5, 8, 13, 21, ........
PART C
Answer any two full questions. Each carries 14 Marks
20 a) Write a program to sort a set of N student names in alphabetical order. A (8)
student name may contain space.
Page 2 of 3
01000CS100092001
b) You are given a two byte unsigned number. Illustate how bitwise operators can (4)
be used to separate the low order byte and high order byte from the given
number.
*****
Page 3 of 3