0% found this document useful (0 votes)
13 views3 pages

Programming in C Model Question Paper

This document is a model question paper for the APJ Abdul Kalam Technological University B.Tech degree examination in Programming in C for the second semester, scheduled for December 2024. It includes various questions divided into two parts: Part A consists of short answer questions, while Part B contains full questions from different modules, each focusing on C programming concepts such as arrays, functions, structures, and file handling. The paper is structured to assess students' understanding and practical skills in programming with a total of 60 marks.

Uploaded by

anupamamlsnmimt
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)
13 views3 pages

Programming in C Model Question Paper

This document is a model question paper for the APJ Abdul Kalam Technological University B.Tech degree examination in Programming in C for the second semester, scheduled for December 2024. It includes various questions divided into two parts: Part A consists of short answer questions, while Part B contains full questions from different modules, each focusing on C programming concepts such as arrays, functions, structures, and file handling. The paper is structured to assess students' understanding and practical skills in programming with a total of 60 marks.

Uploaded by

anupamamlsnmimt
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

MODEL QUESTION PAPER

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY


SECOND SEMESTER B.TECH DEGREE EXAMINATION, DECEMBER 2024

Course Code: GXEST204


Course Name: PROGRAMMING IN C
Max. Marks: 60 Duration: 2 hours 30 minutes

PARTA
Answer all questions. Each question carries 3 marks CO Marks
1 Convert the below if-else to conditional operator 1 (3)
if (first_check)
{
"access denied";
}
else
{
if (second_check)
{
"access denied";
}
else
{
"access granted";
}
}

2 State proper reasons to identify whether the given identifiers are valid or not. 1 (3)
i) 9marks
ii) Mark 2020
iii) v4vote
iv) _csdept
v) @cse
vi) AxB
3 Explain the different ways in which you can declare and initialize a single- 2 (3)
dimensional array.

4 How can a list of strings be stored within a two-dimensional array? How can the 2 (3)
individual strings be processed? What library functions are available to simplify
string processing?
5 Suppose function F1 calls function F2 within a C program. Does the order of the 3 (3)
function definitions make any difference? Explain.

6 Identify the storage class in the below code? 5 (3)


#include<stdio.h>
int a;
int main()
{
printf("a=%d",a);
return 0;
}

7 Suppose a function receives a pointer as an argument. Explain how the function 4 (3)
prototype is written. In particular, explain how the data type of the pointer argument
is represented.
8 While using the statement, fp = fopen( "myfile.c", "r" ) ; what happens if, 5 (3)
− ‘myfile.c’ does not exist on the disk
− ‘myfile.c’ exists on the disk
PARTB
Answer any one full question from each module. Each question carries 9 marks
Module 1
9 a 1 (5)
Write a C Program to check if a given number is a strong number or not.
A strong number is a number in which the sum of the factorial of the digits is equal
to the number itself. Eg:- 145=1!+4!+5!=1+24+120=145
b Write a C program that calculates and prints the result of the following expression: 1 (4)
result = 5 * (6 + 2) / 4 - 3. Explain how parentheses affect the precedence of
operators in this expression.
10 a Write a C program that reads employee's ID, name, status (‘F’ for full-time and ‘P’ 1 (6)
for part-time) and basic pay. DA and HRA for full-time employees are 75% and
10% of basic pay respectively. Part-time employees have basic pay only. Print the
total salary of the employee.

b 1 (3)
Explain the difference between primitive (basic) data types and derived data types
in C. Provide examples for each category. Why is it important to choose the
correct data type for variables in a program?
Module 2
11 a Write a C program to reverse the content of an array without using another array. 2 (4)
b Given a list of cities, their literacy level, and the population, write a program to print 2 (5)
the list cities sorted lexicographically. Assume duplication in city names.. Break the
ties with the value of literacy level, and then the population.
18

a Write a C program to rotate (re-insert rightmost element at the left) elements of an 2 (4)
12 array to the right by n-steps.
b Write a C program that allows the user to enter a line of text, store it in an array, 2 (5)
and then display it backward. The line length should be unspecified (terminated by
pressing the Enter key), but assume it will not exceed 80 characters.

Module 3
13 a Develop a function that takes the two dates as input and compares them. The 3 (4)
function should return 1 if date1 is earlier than date2, return 0 if date1 is later than
date2. Write code to display whether date1 is earlier, later, or the same as date2
based on the function’s result.
b Define a structure named Vehicle with members model (character array), year 2 (5)
(integer), and price (float). Create an array of 10 Vehicle structures and write a
function to accept user input for each vehicle's details and Sort the array in
descending order based on price.
14 a Define a structure that can describe a hotel with the following members: name, 3 (4)
address, grade, average room charge, and number of rooms. Write a function to
print out hotels of a given grade, sorted in order of their average room charges.
b Write a function to print out hotels with an average room charge less than a 3 (5)
specified value in the above problem.
Module 4
15 a Write a c program snippet to open a file in write mode and check if the file opened 5 (4)
successfully. if it fails ,print an error message and terminate the program.
b Two persons want to access a file "sample.txt". First person want to read the data 5 (5)
from the file. The second person want to read and write the data from and to the
file simultaneously. Can you help them to do so by writing the corresponding
programming codes?
16 a Write a function calculates the roots of a quadratic equation with coefficients a, b, 4 (4)
and c (passed as pointer parameters).

b In a small firm, employee numbers are given in serial numerical order, that is 1, 2, 5 (5)
3, etc. − Create a file of employee data with following information: employee
number, name, sex, gross salary. − If more employees join, append their data to the
file. − If an employee with serial number 25 (say) leaves, delete the record by
making gross salary 0. − If some employee’s gross salary increases, retrieve the
record and update the salary. Write a program to implement the above operations.
*****

You might also like