Q1. Define Algorithm and its properties.
Answer:
An algorithm is a step-by-step finite process to solve a specific problem.
Properties:
-
Definiteness → Steps must be clear.
-
Finiteness → Algorithm must end after finite steps.
-
Input → Zero or more inputs accepted.
-
Output → At least one output produced.
-
Effectiveness → Steps must be simple and feasible.
Q2. What is a Flowchart? List its advantages.
Answer:
A flowchart is a graphical representation of an algorithm using symbols like oval (Start/End), rectangle (Process), diamond (Decision), parallelogram (I/O).
Advantages:
-
Easy to understand.
-
Helps in debugging before coding.
-
Improves communication between developers.
Q3. Explain the structure of a C program.
Answer:
Basic structure:
-
Preprocessor directives (
#include <stdio.h>) -
Main function (
int main() { ... }) -
Declarations (variables)
-
Statements (logic/code)
-
Return statement (
return 0;)
Q4. Explain Compilation & Execution of a C program.
Answer:
Steps:
-
Writing → Save program as
.cfile. -
Compilation → Compiler converts C code → machine code.
-
Linking → Connects with libraries.
-
Execution → Run the program → output is shown.
Q5. What are Data Types in C?
Answer:
Data types define the kind of data stored in variables.
-
Basic:
int,float,char,double. -
Derived: arrays, functions, pointers.
-
User-defined: structures, union, enum.
-
Void: no value.
Q6. What are Identifiers and Keywords in C?
Answer:
-
Identifiers: Names given to variables, functions, etc. (e.g.,
marks,sum). -
Keywords: Reserved words with special meaning, cannot be used as identifiers (e.g.,
int,while,return).
No comments:
Post a Comment