Unit 2: Principles of programming - Subjective Questions

CAP1008 — C Programming • Practice Questions with Detailed Answers

20 questions

1

Explain the basic structure of a C program with the help of a suitable example. Describe each section briefly.

2

What is a character set in C? Describe the different categories of characters used in the C language.

3

Define identifiers and keywords. State the rules for constructing valid identifiers in C.

4

Distinguish between constants and variables. Explain the different types of constants in C with examples.

5

Explain the primary (basic) data types available in C along with their typical size and range.

6

Differentiate between formatted and unformatted I/O functions in C with examples.

7

Explain the working of printf() and scanf() functions with syntax, format specifiers, and examples.

8

Describe the functions puts(), gets(), getchar(), and putchar() with their syntax and examples.

9

What is an expression in C? Explain the different types of expressions with examples.

10

Explain the arithmetic operators in C. Discuss integer arithmetic, real arithmetic, and mixed-mode arithmetic with examples.

11

What are unary operators? Explain increment and decrement operators, distinguishing between prefix and postfix forms with examples.

12

Explain relational operators in C. Write a program to demonstrate their use.

13

Explain logical operators in C with truth tables and examples.

14

Explain the assignment operator and its shorthand (compound) forms in C with examples.

15

Explain the conditional (ternary) operator in C with its syntax and an example program.

16

Explain bitwise operators in C in detail. Illustrate each operator with an example.

17

What is type conversion in C? Explain implicit and explicit type conversion with examples.

18

Explain type modifiers (qualifiers) in C. Describe signed, unsigned, short, and long with their effect on data types.

19

Explain operator precedence and associativity in C. Evaluate the expression a = 5 + 3 * 2 - 8 / 4 step by step.

20

Write a complete C program to accept two integers from the user and display their sum, difference, product, quotient, and remainder. Explain the program with proper use of I/O and arithmetic operators.