UNIT I – Programming Constructs & Structures
Q1. Sequential structure kya hoti hai? Example ke sath samjhao.
Ans: Sequential structure ek aisi programming construct hai jisme instructions ek ke baad ek
sequence mein execute hote hain. Example: int a=5, b=10, c; c = a + b; printf("%d", c); Isme har
statement sequentially execute hoti hai.
Q2. Various types of data ko list kijiye.
Ans: C language mein commonly used data types: 1. int 2. float 3. double 4. char
Q3. Arithmetic operators aur assignment operators mein antar likhiye.
Ans: Arithmetic operators (+, -, *, /, %) mathematical calculations ke liye use hote hain. Assignment
operators (=, +=, -=, *=, /=) variables ko value assign karne ke liye use hote hain.
Q4. scanf() aur printf() functions ka use kya hai?
Ans: printf() function output display karne ke liye use hota hai aur scanf() function input lene ke liye
use hota hai.
Q5. Macro aur #define ke beech difference likho.
Ans: Macro ek preprocessor directive hai jo code ke execution se pehle replace ho jata hai. #define
ka use constant ya macro define karne ke liye hota hai. Example: #define PI 3.14
Q6. Programming constructs ke different types explain kijiye.
Ans: Programming constructs 3 types ke hote hain: 1. Sequential – instructions order mein execute
hoti hain. 2. Selective – condition ke basis par statements execute hoti hain (if, if-else, switch). 3.
Repetitive – statements repeatedly execute hoti hain (for, while, do-while).
Q7. Relational operators aur logical operators ka working explain karo.
Ans: Relational operators (<, >, <=, >=, ==, !=) do values compare karte hain. Logical operators
(&&, ||, !) multiple conditions ko evaluate karte hain.
Q8. Conditional statements ko explain karo aur flowchart banao.
Ans: Conditional statements program ko decision making ki ability dete hain. Types: if, if-else,
nested if. Flowchart mein condition check hota hai aur uske according true/false path follow hota
hai.
Q9. Multi-way conditional statement (switch-case) explain karo.
Ans: Switch-case ek control statement hai jo ek variable ke value ke according multiple cases me
se ek ko select karta hai. Syntax: switch(variable) { case 1: ...; break; case 2: ...; break; default: ...;}
Q10. Repetitive structures ka comparison karo.
Ans: For loop: Jab iterations ki ginti pehle se pata ho. While loop: Jab condition pehle check karna
ho. Do-while loop: Jab kam se kam ek baar statement execute karna ho.