QNo 1-: Who Developed C programming language?
Dennis Ritchie in 1972 at BELL labs
QNo 2-: What type of language C is?
C is procedure oriented language and C is a general purpose language.
QNo 3-: What are the features of C language?
C exhibits the following features.
QNo 4-: What is meant by High level language?
A programming language which can be understand by humans is known as High level language. Generally High Level Language similar to English. Examples: C, C++, Java, FORTRAN, COBOL etc.
QNo 5-: What is meant by Machine level language?
The language which is understand by machines is called as Machine Level Language. Generally it is represented with 0’s and 1’s. This is also called as binary language or low level language. Humans cannot understand this language.
QNo 6-: History of C language?
QNo 7-: Define Algorithm.
Step by step process to solve a problem is known as Algorithm. Any problem can be solved with the help of algorithm. The algorithms are used in system design or programming as a preliminary design.
Q No 8 :- Explain the characteristics algorithm
Every algorithms must have the following characteristics those are
Q No 9 :- What is Flowchart?
Pictorial representation of algorithm is known as Flowchart. Flowchart gives problem solution diagrammatically. In flowchart various symbols are used to represent various activities. Even though Algorithm and flowcharts serves same purpose but flowcharts makes the user to understand system more easily than algorithm.
Q No 10 :- List out the symbols used in Flowcharts and their activity?
Q No 11 :- What are the data types are present in C language?
C language supports 3 different types of data types those are
Q No 12 :- List out the primitive data types supported by C language?
Primitive data type are
Q No 13 :- List out the extended data types supported by C language?
Q No 14 :-List out the User data types supported by C language?
Enum
Q No 15 :- What is Interperter?
Interpreter is a translator which converts the high level language into low level language line by line. It means interpreter converts the high level language instructions into low level language statement by statement. If any error encountered in a line then the interpreter stops conversion there itself. If the error is removed then it resumes the conversion.
Q No 16 :- What is Compiler?
Compiler converts the high level language program all instructions at a time. At the end of the translation it lists out the errors if present.
Q No 17 :- Differentiate Compiler and Interpreter
Interpreter | Compiler |
---|---|
Conversion is done statement by staement | Entire program is converted at a time |
Slower than Compiler | Faster |
Conversion process is stopped if error appears. | Conversion is done irrespective of errors. |
Easys to implement | Complex to implement |
Q No 18 :- List out the operators of C language
Operators are the special characters represent a specific operation. The operation on which performed is called as operands. Based on the operands there are two different operators are present those are
based on type of operation the operators types areQ No 19 :- Write about Arithmetic operators of C language
Ans:- Arithmetic Operators are the operators which are used arithemetic operations like Addition , Subtraction, Multiplication, Division.
Q No 20 :- Write about Logical operators of C language
Ans:-
In C programming, logical operators are used to perform logical operations on boolean values (i.e., values that are either true or false). C provides three main logical operators:
Q No 21 :- Write about Bitwise Logical operators of C language
Ans:-
Bitwise logical Operators are the operators which are used to do Bitwise logical operations like AND ,
OR and NOT. The Bitwise operation is performed on the bits of the operands rather than the values. When we
apply these operations on the operands the operations are perfomed on the binary equivalent of the
operands.
& is used for AND
| is used for OR
~ is used for NOT
Q No 22 :- Write about Relational operators of C language
Ans:-
In C, relational operators are used to compare two values and determine the relationship between them.
These operators return a Boolean value, which is either true (represented as 1) or false (represented as 0),
indicating whether the specified relationship holds true or not. Relational operators are commonly used in
conditional statements to make decisions based on the result of the comparison.
Here are the relational operators in C:
Q No 23 :-What is meant by variable?
Ans:- Variable is a name given to a memory location. In generally we do computaions on some values or numbers. These values are stored in computer memory in some address location. If we want to access the values we have to use the memory address which is very complex task to remember the memory location (address). In order to over come this problem a name is given to the address. Remembering name is easier than memory location.
Q No 24 :-What the rules to be followed while creating variable?
Ans:-
Q No 25 :-List out some keyword of c language
Ans:-
Q No 26 :-Explain about Unary operators of c language
Ans:- Operators are the special characters represent a specific operation. The operation on which performed is called as operands. Based on the operands there are two different operators are present those are
Operators which are applied on single operand are called as unary operators. Increment decrement operators comes under unary operators. There are two different types of unary operators are present. Those
There are increment and decrement operators are present in C.
++ operato is called as increment operator. This operator is used on a single operand hence it is called as unary operator. This operator adds 1 to the operand.
int a=10
a = a++ // result is 11
ii operato is called as decrement operator. This operator is used on a single operand hence it is called as unary operator. This operator subracts 1 from the operand.
int a=10
a = a-- // result is 9
Q No 27 :-Explain about Conditional operators of c language
Ans:- Conditional Operators also known as Ternary operator is only one operator present in C. The ternary operator is combination of two special characters those are ? and :. The ternary operator is exactly replaces the if else control block. Shortest form of if else is ternary operator.
Syntax of ternary operator.
(conditional statement)? statement1 : statement2;
Q No 28 :-Write Structure of C Program
Ans:- Every programming language laid out some rules to be followed when we are writing programs. The collection of rules to write a program is known as structure.
Q No 29 :-Write about preprocessor derectives and give examples of preprocessor directives
Ans:-
Preprocessor directives are the instructions given to system which are processed before actual exectuion of
a program. In preprocessor directives we include the header files which are to be fetched and included before
execution of the actual program.
Examples:
#include<stdio.h>
#include<string.h>
Q No 30 :-Write use of printf() and scanf() functions
Ans:-
printf() is used to print the messages on the output device. printf() is out put function.
scanf() is used to initialize the variable in runtime. scanf() is input function.
Q No 31 :-List out the control flow statement in C language
Ans:-
There are 2 different types of control flow statements those are:
1) Conditional Control Flow statements. Example: if, if-else, if else if, switch
2) Iterative Control Flow statements. Example: for, while, do- while.
Q No 32 :-Explain How "if" works and write the syntax of if in C language
Ans:-
if (condition) {
// code block to be executed if the condition is true
}
if (x > 5) {
// code to be executed if x is greater than 5
// code to be executed if the condition is true
}
Q No 33 :-Explain How "if lese" works and write the syntax of if-else in C language
Ans:-
if (condition) {
// code block to be executed if the condition is true
}
else{
// code block to be executed
}
if (x > 5) {
// code to be executed if x is greater than 5
// code to be executed if the condition is true
}
else{
// code to be executed if x is less than 5
// code to be executed if the condition is false
}
Q No 34 :-Explain How "if lese if" works and write the syntax of if else if in C language
Ans:-
Control statements are an essential part of programming languages and play a crucial role in determining the flow of execution in a program. If some problem we have to check many conditions to be checked in this scenario if and if else will not work. For this a new control statement is required in which is called as if else if control flow statement. In this the control flow starts with if condition and ends with else block. In between if , else one or more than one else if blocks will be present. Each else if block consists of one condition statement if the condition is ture then the purticular else if block will be executed else next subsequent else if block condtion will be checked. if none of the else if conditons are true then else block will be executed.
if (condition1) {
// code block to be executed if the condition is true
}
else if(condition2 ){
// code block to be executed
}
else if(condition3 ){
// code block to be executed
}
...
else{
//code
}
Q No 35 :-Explain How "switch" works and write the syntax of switch in C language
Ans:-
Switch works same as if else if but the syntax is very compact and very neat.
switch (constant/variable/equation) {
case 1: code
break;
case 2: code
break;
case 3: code
break;
....
default: code
break;
}
Q No 36 :-Explain for loop in C language
Ans:-
A for loop in C is a control flow statement that allows you to repeat a block of code a specified number of times.
The for loop has the following syntax:
for (initialization; condition; update/increment/decrement) {
// statement block to be executed repeatedly
}
The initialization statement is executed once, before the loop starts. The condition statement is evaluated before each iteration of the loop. If the condition is true, the statement block is executed. If the condition is false, the loop terminates. The update statement is executed after each iteration of the loop. The update statement can be used to increment or decrement a variable, or to change the value of a variable in some other way.
Here is an example of a for loop in C:
C
for (int i = 0; i < 10; i++) {
System.out.println(i);
}
This code will print the numbers from 0 to 9. The initialization statement declares a variable named i and initializes it to 0. The condition statement evaluates whether i is less than 10. If it is, the statement block is executed. The statement block prints the value of i. The update statement increments i by 1. This ensures that the condition statement will eventually be false, and the loop will terminate.
The for loop is a powerful tool for repeating a block of code a specified number of times. It is a common control flow statement in , and it is used in many different programming tasks.
Here are some of the benefits of using for loops in C:
Q No 37 :-Explain while loop in C language
Ans:-
A while loop in C is a control flow statement that allows you to repeat a block of code a specified number of times.
The while loop has the following syntax:
initialization;
while ( condition ) {
// statement block to be executed repeatedly
update/increment/decrement
}
The initialization statement is executed before start of while once. The condition statement is evaluated before each iteration of the loop. If the condition is true, the statement block is executed. If the condition is false, the loop terminates. The update statement is executed after each iteration of the loop. The update statement can be used to increment or decrement a variable, or to change the value of a variable in some other way.
Here is an example of a for loop in C:
int i = 0;
while ( i < 10) {
System.out.println(i);
i++
}
This code will print the numbers from 0 to 9. The initialization statement declares a variable named i and initializes it to 0. The condition statement evaluates whether i is less than 10. If it is, the statement block is executed. The statement block prints the value of i. The update statement increments i by 1. This ensures that the condition statement will eventually be false, and the loop will terminate. The for loop is a powerful tool for repeating a block of code a specified number of times. It is a common control flow statement in C, and it is used in many different programming tasks.
Q No 38 :-Explain do while loop in C language
Ans:-
A do while loop in C is a control flow statement that allows you to repeat a block of code a specified number of times.
The do while loop has the following syntax:
initialization;
do{
// statement block to be executed repeatedly
update/increment/decrement
}while ( condition ) ;
The initialization statement is executed before start of while once. The condition statement is evaluated after execution of do block. If the condition is true, the do block is executed. If the condition is false, the loop terminates. The update statement is executed after each iteration of the loop. The update statement can be used to increment or decrement a variable, or to change the value of a variable in some other way.
Here is an example of a for loop in C:
int i = 0;
do{
System.out.println(i);
i++
}while ( i < 10) ;
This code will print the numbers from 0 to 9. The initialization statement declares a variable named i and initializes it to 0. The condition statement evaluates whether i is less than 10. If it is, the statement block is executed. The statement block prints the value of i. The update statement increments i by 1. This ensures that the condition statement will eventually be false, and the loop will terminate. The for loop is a powerful tool for repeating a block of code a specified number of times. It is a common control flow statement in C, and it is used in many different programming tasks.
Q No 39 :- Write the difference between while and do while loop
while | do-while |
---|---|
Condition is checked before executing the iterative statements. | Condition is checked after executing the iterative statements. |
Semicolon is not used after while. | Semicolon is used after while. |
while Syntax:
initialization; |
do while syntax:
initialization; |
Q No 40 :-Deifine Array
Ans:-
Array is collection of homegenious elements. It means array consists of same type of elements.
Array can be any type. It may integer , float or character.
Syntax of Array Declaration:
datatype arrayname[size of array];
Example:
int marks[10];
Q No 41 :-How to initialize Array and display array elements?
Ans:-
Array can be initialized by specifying the index in the squire brackets. If we want
to initialize first element then we have to specify as follows
marks[0]=20;
The above statement can be interpreted as first element of marks array is initilizes with 20;
Similarly if we want access or display we have to specify the index of the array
which we want to access. Example
printf("%d", marks[2]);
The above print statement prints third element of marks array.
Q No 42 :-List out the types of array supported by C languate?
Ans:-
There are three types of arrays in C those are
Q No 43 :-Deifine String
Ans:-
Sring is collection of characters. Strings can be implemented by using character arrays.
Syntax of String Declaration:
char arrayname[size of array];
Example:
char name[10];
Q No 44 :- Write String handling functions
Ans:-
String Handlingl Functions:
strlen(): This function returns the length of the given string.
strcpy(): This function is used to copy string in to another string.
strcmp(): This function is used to compare two strings.
strcat(): This function is used to concatenate two strings
strupr(): This function returns the upper case of the given string.
strlwr(): This function returns the lower case of the given string.
Q No 45 :-Deifine Structure
Ans:-
Structure is a user defined data type which hold or store heterogeneous/different types data
item or element in a single variable. It is a Combination of primitive and derived data type.
or
A structure is a collection of one or more data items of different data types, grouped together under a single name.
Variables inside the structure are called members of structure. Each element of a structure is called a member.
struct keyword is used to define/create a structure. struct define a new data type which is
a collection of different type of data.
Syntax
struct structure_name /tag name
{
data_type varialbe1;
data_type varialbe2;
.
.
data_type varialben;
};
Note: Don't forget the semicolon }; in the ending line.
Example
struct teacher
{ int eid;
char name[50];
float salary;
char subject[20];
};
Q No 46 :-Deifine Union
Ans:-
Union is a user defined data type which store heterogeneous/different types data
item or element in a single variable. It is a Combination of primitive and derived data type.
or
A Union is a collection of one or more data items of different data types, grouped together under a single name.
Variables inside the Union are called members of Union. Each element of a Union is called a member.
union keyword is used to define/create a Union. union define a new data type which is
a collection of different type of data.
Syntax
union Union_name /tag name
{
data_type varialbe1;
data_type varialbe2;
.
.
data_type varialben;
};
Note: Don't forget the semicolon }; in the ending line.
Example
union teacher
{ int eid;
char name[50];
float salary;
char subject[20];
};
Q No 47 :-Deifine pointer
Ans:-
datatype variable;
datatype *pintervariable=&varialbe //pointer declarion
Q No 48 :-Deifine Searching
Ans:-
Q No 49 :Deifine Sorting
Ans:-
Q No 50 :Deifine Functions
Ans:-
Q No 51 : Classify Functions based on sisgnature
Ans:-
Based on signature there are 4 types of functions in C. Those are
Q No 52 : Classify Functions based on parameters
Ans:-
Based on parameter type there are 3 types of functions in C. Those are