0% found this document useful (0 votes)
4 views2 pages

C Programming Exam Solutions Guide

The document contains a collection of solved answers for a first-year university exam in C programming, covering key concepts such as algorithms, data types, loops, and functions. It includes definitions, examples, and comparisons of library and user-defined functions, as well as practical programming tasks like calculating the area of a circle and swapping variables. Additionally, it provides insights into control structures like switch statements and the differences between while and do-while loops.

Uploaded by

deepakgunjal.8d
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)
4 views2 pages

C Programming Exam Solutions Guide

The document contains a collection of solved answers for a first-year university exam in C programming, covering key concepts such as algorithms, data types, loops, and functions. It includes definitions, examples, and comparisons of library and user-defined functions, as well as practical programming tasks like calculating the area of a circle and swapping variables. Additionally, it provides insights into control structures like switch statements and the differences between while and do-while loops.

Uploaded by

deepakgunjal.8d
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

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.

You might also like