Subject Code:24CT11RC02 R-24 Reg No:
GAYATRI VIDYA PARISHAD COLLEGE OF ENGINEERING FOR WOMEN
(AUTONOMOUS)
(Affiliated to Andhra University, Visakhapatnam)
I [Link]. - I Semester Regular Examinations, December / January – 2025
Problem Solving using C
(Common to CSE, CSE-AIML, ECE and IT)
1. All questions carry equal marks
2. Must answer all parts of the question at one place
Time: 3Hrs. Max Marks: 70
UNIT-I
1. a. Discuss the basic structure of a C program and explain the role of each component
b. Illustrate the purpose of the main() function in a C program with an example
OR
2. a. Identify the types of constants in C and provide examples for each
b. Compare primitive data types and derived data types in C, providing examples
UNIT-II
3. a. Implement a C program using if-else statements to check whether a number is positive or negative.
[Link] a switch statement in C to display the name of a day based on the number input
OR
4. a. Explain the structure of a for loop in C with an example.
b. Develop a C program that uses a while loop to compute the sum of the first 10 natural numbers
UNIT-III
5. a. Declare and define a function in C to compute the factorial of a number
[Link] call by value and call by reference, using examples to demonstrate each
OR
6. [Link] a C program to demonstrate dynamic memory allocation using malloc() and free()
b. Describe pointer operations and demonstrate the use of pointers to access and modify variable values
UNIT-IV
7. a. Define a structure in C and use it to display the information of a student (name, roll number, marks).
b. Implement a union in C and explain how it differs from a structure with an example
OR
8. a. Define and demonstrate the use of bit-fields in C
b. Write a C program to access individual elements in an array of structures
UNIT-V
9. a. List the modes of file operations in C and explain their use with examples
b. Develop a C program that reads from a text file and displays its contents
OR
10. a. Implement a C program that reads the data from one file and writes it to another file
b. Use command-line arguments in a C program to accept two numbers and display their sum