Short Q/A
1. Why C is a case sensitive language (learn from file name : Important QA of U#3. CS)
2. Preprocessor directives (learn from file name : u3 an overview of c language)
3. Library files (conio.h, stdio.h, math.h) (learn from file name : Important QA of U#3. CS)
4. Rules for naming a variables (learn from file name : u3 an overview of c language)
5. Reserve keywords with example (learn from file name : Important QA of U#3. CS)
6. Escape sequence with example (learn from file name : Important QA of U#3. CS)
7. Format specifier with example (learn from file name : Important QA of U#3. CS)
8. Comment and it's types (learn from file name : u3 an overview of c language)
9. Convert mathematical expression in C expression
10. Library function (printf(), scanf(), pow(), sqrt(), abs(), clrscr(), etc)
11. Local and global variable (learn from file name : CH 9 FUNCTIONS)
12. Source and object code The answer is written below)
13. Definition of loop (for, while and do-while) (learn from file name : UNIT#8ITERATION AND IS TYPES)
14. Prototype function (learn from file name : CH 9 FUNCTIONS)
15. Function and it's advantages (learn from file name : CH 9 FUNCTIONS)
16. Array with example (learn from file name : cha # 12 array)
17. Define string with example (learn from file name: ch 13 string)
18. Basic structure of C language (learn from file name: U#1 concept of computer programming)
19. Error and it's types (The answer is written below)
Errors and Their Types in C
In the C programming language, an error is a problem that prevents the program from compiling, linking,
or running correctly. Errors must be fixed before the program executes successfully.
C errors are mainly divided into three types:
1. Compile-Time Errors
These errors occur during compilation (before the program runs).
They are found by the compiler.
Examples
Syntax Errors (missing ;, {}, wrong keywords)
Type Errors (assigning float to int incorrectly)
Undeclared variables
Missing header files
Example Code
int main() {
int a
printf("%d", a);
}
❌ Missing semicolon — compile-time error.
2. Run-Time Errors
These errors occur while the program is running.
They are not detected by the compiler.
Examples
Division by zero
Invalid memory access
Array out of bounds
File not found
Example Code
int a = 10, b = 0;
printf("%d", a / b);
❌ Division by zero — run-time error.
3. Logical Errors
The program runs normally but gives wrong output due to incorrect logic.
Examples
Using + instead of -
Incorrect conditions in loops or if-statements
Wrong formula in calculations
Example Code
int a = 5, b = 3;
printf("%d", a * b); // intended addition
❌ Logic is wrong — output is incorrect.
Difference Between Source Code and Object Code
Source Code Object Code
Written by the programmer in a high-level language Generated by the compiler after translating
like C, C++, Java. the source code.
Human-readable. Not human-readable (machine code /
binary).
Stored in files with extensions like .c, .cpp, .java. Stored in files with extensions like .obj, .o.
Needs to be compiled before execution. Cannot run directly; must be linked to create
executable file.
Contains instructions, variables, functions written in Contains machine instructions, relocatable
high-level syntax. code, and symbols.
Can be edited easily by programmers. Cannot be easily edited.
Example: printf("Hello"); Example: Machine-level instructions (binary).