1.) What is C? Write its Features.
C is a general-purpose, procedural programming language developed in the early 1970s by Dennis Ritchie.
Features:
- Simple and efficient
- Fast execution
- Low-level access to memory
- Structured programming
- Rich set of built-in operators and functions
2.) What are the advantages and disadvantages of C programming Languages?
Advantages:
- Portable and efficient
- Modular and structured
- Fast compilation and execution
- Extensive library support
Disadvantages:
- No object-oriented features
- No runtime checking
- Less support for high-level abstractions
3.) What is a Data type? Explain the type of data with examples.
Data types define the type of data a variable can hold.
Types:
- int: Integer (e.g., int a = 5;)
- float: Decimal (e.g., float b = 3.5;)
- char: Character (e.g., char ch = 'A';)
- double: Large decimal numbers
4.) What is a variable? Explain its types.
Variable is a name given to a memory location.
Types:
- Local Variable
- Global Variable
- Static Variable
- External Variable
5.) What is an operator? Write its types and explain any four of them.
Operators perform operations on variables.
Types:
- Arithmetic (+, -, *, /, %)
- Relational (==, !=, >, <)
- Logical (&&, ||, !)
- Assignment (=, +=, -=)
6.) What is a control structure? Write a difference between break and continue statements with
examples.
Control structures control flow of execution.
Break exits the loop early. Continue skips current iteration.
Example:
for(i=0;i<5;i++) {
if(i==2) break;
for(i=0;i<5;i++) {
if(i==2) continue;
7.) What is looping? Write the difference between while and Do while loop with examples.
Looping is repeating a block of code.
while: Condition checked before loop.
do-while: Condition checked after loop.
Example:
while(i<5){...}
do{...}while(i<5);
8.) Define the term array. What is the string? Explain any four-string handling function for example.
Array: Collection of similar data types.
String: Array of characters ending with null '\0'.
Functions:
- strlen() - length of string
- strcpy() - copy string
- strcat() - concatenate strings
- strcmp() - compare strings
9.) What is the functions? Write its features and describe its types.
Function is a reusable block of code.
Features: Reusability, modularity.
Types:
- Library functions (e.g., printf)
- User-defined functions
10.) What is the recursion technique? Explain with one example.
Recursion is when a function calls itself.
Example:
int fact(int n){
if(n==1) return 1;
return n*fact(n-1);
11.) What is the concept of storage? Differentiate between automatic storage and external storage.
Storage class defines scope and lifetime.
Automatic: Default inside functions, memory freed after use.
External: Global scope, retains value throughout program.
12.) What is a Structure? Explain with one example.
Structure is a user-defined data type.
Example:
struct Student {
int id;
char name[20];
};
13.) Differentiate between array and structure.
Array: Collection of same type.
Structure: Collection of different types.
14.) Differentiate between structure and union.
Structure: All members have separate memory.
Union: All members share same memory.
15.) Differentiate between array and pointer.
Array: Fixed size, stores multiple values.
Pointer: Stores address of variable.
16.) Define the terms call by value and call by reference with examples.
Call by value: Copies value. Original not changed.
Call by reference: Passes address. Original can be changed.
17.) What is a pointer? Explain with examples.
Pointer is a variable storing address of another variable.
Example:
int a = 5;
int *p = &a;
18.) Differentiate between Structure and Pointer.
Structure: Data type grouping variables.
Pointer: Variable storing address.
19.) Differentiate between sequential access and random access techniques of data file.
Sequential: Data accessed in order.
Random: Direct access to any part.
20.) Differentiate between fprintf and fscanf function.
fprintf: Writes to file.
fscanf: Reads from file.