FIRST YEAR UNIVERSITY EXAM – C PROGRAMMING SOLVED ANSWERS
Q1. Attempt any Eight.
1. Algorithm: Step-by-step procedure to solve a problem.
2. printf(): Library function to display output.
3. Data types: int, float, double, char, void.
4. C is high level – True.
5. Types of arrays: 1D, 2D, Multidimensional.
6. C token: Smallest unit of a program.
7. Types of loops: for, while, do-while.
8. Recursion: Function calling itself.
9. Compiler: Converts source code into machine code.
10. Keyword: Reserved word with special meaning.
Q2. Attempt any Four.
Flowchart: Diagrammatic representation of steps. Symbols used: oval, rectangle, diamond.
Library vs User-defined Function:
- Library: Predefined functions (printf, scanf).
- User-defined: Written by programmer.
2D Array: Stores data in rows & columns. Example: int a[3][3];
Ternary Operator: (condition ? true : false)
Swap Program:
int a,b,temp; temp=a; a=b; b=temp;
Q3. Attempt any Two.
Algorithm for Area of Circle:
1. Start
2. Read r
3. area = 3.14*r*r
4. Display area
5. Stop
Factorial Program: Loop multiplying numbers up to n.
if-else Example: if(a>b) printf("A"); else printf("B");
Q4. Attempt any Two.
Transpose of Matrix: Swap rows & columns.
Maximum of Two Numbers: Compare using if.
While vs Do-while:
- while checks first
- do-while executes once before checking
Q5. Short Note (Any One)
Switch Statement: Used for multi-way decision.
Variable: Named memory location. Rules: No spaces, cannot start with digit, no keywords,
case-sensitive.