[go: up one dir, main page]

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

Iae3 QB

The document contains a series of questions and programming tasks related to C programming concepts, including functions, pointers, structures, unions, file handling, and recursion. It covers theoretical definitions, practical programming exercises, and comparisons of data structures. The tasks range from simple definitions to complex programming challenges, emphasizing both understanding and application of C programming principles.

Uploaded by

aabi2280932
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Iae3 QB

The document contains a series of questions and programming tasks related to C programming concepts, including functions, pointers, structures, unions, file handling, and recursion. It covers theoretical definitions, practical programming exercises, and comparisons of data structures. The tasks range from simple definitions to complex programming challenges, emphasizing both understanding and application of C programming principles.

Uploaded by

aabi2280932
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

2 marks

1. What is a function in C programming?


2. Differentiate between call by value and call by reference.
3. What is the purpose of the return statement in a function?
4. Define recursion and give an example of its usage.
5. What is a pointer, and how is it declared in C?
6. What is the use of the dereference operator (*) in pointers?
7. What is a null pointer in C?
8. What are preprocessor directives?
9. Define a structure and explain its purpose in C programming.
10. How does a union differ from a structure in terms of memory allocation?
11. What is the purpose of the fopen() function in file handling?
12. What are the differences between text files and binary files?
13. How can a file be opened in read and write modes in C?
14. What is the significance of the fclose() function in file handling?
15. What are library functions? Give an example.
16. Define function and name the different types of functions
17. Compare formal arguments and actual arguments.
18. Create a structure variable named s1 and two data types as int and char. Assign any values to the corresponding data
types and access it through structure variable and print the result.
19. Define Union and structure.
20. What is the difference between a function declaration and a function definition?
21. Why are function prototypes used in C?
22. How is a pointer initialized in C?
23. What is the difference between int *p and int p?
24. How do you declare and access a structure in C?
25. What is a nested structure? Provide an example.
26. What is the advantage of using a union over a structure?
27. How is memory allocated for union members?
28. What are the modes in which a file can be opened in C?
29. What is the purpose of the fprintf() function in file handling?
30. What is the difference between fread() and fwrite()?
31. How can you check for the end of a file in C?
32. Write a statement to access the third element of an array using pointers
33. What is the output of the following program
#include <stdio.h>
void square (int* num) {
*num = (*num) * (*num);}
intmain () {
int x = 5;
square(&x);
printf ("%d\n", x);
return 0;
}

13 marks

1. Write a program to demonstrate call by value and call by reference in C


2. Write a program to multiply two numbers by passing arguments to the sub functionand
returningvalues to the main function.
3. Describe about the 3 aspects of function.
4. Write the structure and syntax of a user-defined function with an example.
5. Write a program to swap 2 numbers using call by reference, where you need to pass the
address as arguments.
6. Write about the usage of Increment operator and comparison operator in pointers with a
simple example.
7. Describe pointer arithmetic with suitable examples.
8. Create a structure called "Student" with members name, age, and total marks. Write a C
program to input data for two students, display their information, and find the average of
total marks
9. Explain in detail about the following file operations with a simple example in C.Opening a
file, closing a file, reading a file and writing a file
10. The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci
sequence, such that each number is the sum of the two preceding ones, starting from 0
and 1. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given n, calculate F(n).
11. You are tasked with creating a program for an Employee Management System. The
system needs to store the details of only 2 employees, such as their name, employee ID,
salary, and date of joining. You need to use structures to store this information
12. What is recursion? Write a program to calculate the factorial of a number using
recursion.
13. Compare the use of structures and unions in terms of memory efficiency with a suitable
program.
14. Write a program to create a file and write a list of student names and grades into it.
Examine the program and list all the problems related to uninitialized variables and input
validation.
15. Write a C program for the given scenario. You are climbing a staircase. It takes n steps
to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways
can you climb to the top?
Example 1:
Input: n = 2
Output: 2
Explanation: There are two ways to climb to the top.
1. 1 step + 1 step
2. 2 steps
16. State the role of preprocessor directives in C programming. How do they influence the
program compilation process?
17. Write a C program that swaps the values of two variables using pointers. Demonstrate
how this approach works by providing an example with user input.
18. Write a C program to demonstrate the use of a union to store and display the details of a
product, such as product ID (int), product price (float).
19. Write a C program to calculate the factorial of a number using a recursive function.
20. Using a union, design a program that can store different types of data (integer, float, and
character) and display them based on user input. Illustrate how a union works with an
example

You might also like