All Intro to Programming Answers
All Intro to Programming Answers
Q1:
1. Keywords are reserved (e.g., int, return). Identifiers are user-defined names (e.g., age). Identifiers
must not be keywords, must begin with a letter/underscore, and cannot have special characters.
2. Steps: 1. Preprocessing -> 2. Compilation -> 3. Assembling -> 4. Linking -> 5. Execution
3. i) double
iii) char
iv) float
4. Precedence defines operation order (* over +). Associativity determines direction (e.g., left-to-right
for +, -).
5. Header files:
i) stdio.h - input/output
Q2:
1. Operators in C: Arithmetic (+,-), Relational (==, !=), Logical (&&, ||), Bitwise (&, |), Assignment (=,
+=) etc.
2. i) j = 7 + 8*8 = 71
iii) -10%-3 = -1
Q3:
1. Program:
int sum = 0;
Q4:
Example:
Q1:
Result: M - N = 011100010
2. b) Design Flow: Understand problem -> Create Algorithm -> Draw Flowchart -> Code -> Compile
-> Test
4. d) ASCII (7-bit), EBCDIC (8-bit IBM). ASCII is standard, EBCDIC is less common.
5. e) Operator: symbol for operation. Types: Arithmetic (+), Relational (==), Logical (&&), Bitwise (&),
Assignment (=).
UNIT-I:
UNIT-II:
Q5:
UNIT-III:
1. Entry Controlled: while, for
2. Print pattern: Use nested for loops with rows and columns.
UNIT-IV:
2. b) Format Arg = %d, Actual Arg = passed in call, Declaration = prototype, Definition = with body
Q8:
Q9:
1. a) Pointer to Const = value can't change. Const Pointer = address can't change.