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

C Programming SET D Final

Uploaded by

Aashish Rokka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

C Programming SET D Final

Uploaded by

Aashish Rokka
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SECTION C

LONG ANSWER QUESTIONS


Answer ANY TWO Questions. (2x10=20)

1. A record contains name of football players, his age and number of matches that he
has played and the average goals he has scored in each match. Create an array of
structures to hold records of 10 such football players and write a program to read
these records and arrange them in ascending order by average goals.

2. Write a menu driven program that depicts the working of a library. The menu
option should be
a. Add book information.
b. Display book information by ascending order by book name.
c. List the count of book in the library.
d. List the information about the book whose id is given by the user.
e. Exit

Create a structure called library to hold book id, title of the book, author name and
price of the book [Mandatory Question]

3. Write a program to read a structure “book” having title, price and published date.
Date is another structure having year, month and day as its members. Enter 10
book records from the user and write in a file “record.txt”.
PRE-TEST EXAMINATION PAPER
Program : BSc.IT
Course : Introduction C Programming
Course Code : CT018-3-1
Year/ Semester : I Year / I Semester
Intake : September,2023
Date : 9th February 2024
Time Duration : 1.5 Hours
Set :D

Instruction to candidates
1. This question paper has Three (3) Sections.
2. Answer ALL questions in Section A, Very Short Answer Questions.
3. Answer Five out of Seven questions in Section B, Short Answers Questions.
4. Answer Two out of Three question in Section C, Long Answers Questions.
5. No scripts or answer sheets are to be taken out of the Examination Hall.
6. Mobile phones are strictly prohibited in the Examination Hall.

Do not open this question paper until instructed.


SECTION A
Multiple Choice Question (10x1=10)
1. Which of the following declarations is not supported by the C language?
a. String str; c. float str = 3e2;
b. char *str; d. Both c and d
2. What is the output of the following program?
#include <stdio.h>
int main()
{
int y = 10000;
int y = 34;
printf("Hello World! %d\n", y);
return 0;
}
3. Which of the following is used to forcefully exit a loop?
a) stop
b) halt
c) exit
d) break
4. Which of the following is true about recursive functions in C language?
a) A recursive function cannot call itself.
b) A recursive function must have a base case to terminate the
recursion.
c) A recursive function must have a return type of void.
d) A recursive function cannot be called from another function.

5. Which of the following function declarations is illegal?

a) double fuc();
int main() { }
double func() { }
b) double func() { };
int main() { }
c) int main()
{
double func();
}
double func() { //statements}
d) None of the mentioned
6. In c programming, sizeof() function returns:
a) The length of an array in integer c) The array values one by one
b) The bytes size required to allocate in memory d) None of the above
7. In C, what is the value of a pointer variable if it hasn’t been assigned any
address?
a) 0 c) undefined
b) Null d) 1
8. Structure is a collection of:
a) Similar data types c) Values
b) Different data types d) None of the above
9. Select a function which is used to read a single character from a file at a time?
a. fputc( ) c. fputs( )
b. fscanf( ) d. fgetc( )

10. Which is a valid C expression?


a) int my_num = 100,000; c) int my num = 1000;
b) int my_num = 100000; d) int $my_num = 10000;

SECTION B
SHORT ANSWER QUESTION
Answer ANY FIVE Questions. (5x4=20)

1. Why do we need control statements? Compare switch and if-else-if nested


statement with example.
2. Explain about the while loop with its syntax and flowchart and example?
3. What is the difference between arrays of structure and arrays inside the structure?
Explain with an example.
4. Write a program to check whether the diagonal elements of a (2x2) matrix are all
Zero.
5. Define and write the syntax of following:
a. fopen()
b. fprintf()
c. fscanf()
d. strcmp()
e. gets()
6. What is a nested structure? How do you access the members of the nested
structure? Explain with an example.
7. What are the key differences between a user-defined data type and a primitive data
type? Explain with the example.

You might also like