Basic C
C is oops or structure oriented programming language ?
C is not Object oriented programming language, it is structure oriented programming language.
Why C called mother language ?
C is also called mother Language of all programming Language, because it support some features of low level programming language and basic of all high level programming language.
Why use C language ?
C language is used for develop system software and Operating System.
C is platform dependent language ?
Yes, It is platform dependent language, because it not run on other system with respect to its development.
C is case sensitive language ?
Yes, C is a case sensitive programming language. In C programming 'break and BREAK' both are different.
What is keyword ?
Keyword is a predefined or reserved word in C library with a fixed meaning and used to perform an internal operation. C Language supports 32 keywords.
Keywords in C
What is Constant ?
It is an identifier whose value can not be changed at the execution time of program. In general
constant can be used to represent as fixed values in a C program.
Read more.....
What is Garbage value ?
Garbage value can be any value given by system and that is no way related to correct programs. It is a disadvantage and it can overcome using variable initialization.
In c programming avoid garbage collection by using variable initialization
What is data type ?
Data type is a keyword used to identify type of data. Data types are used for representing the input of the user in the main memory (RAM) of the computer.
Read more......
What is difference between compiler and interpreter
What is Data Type Modifiers ?
In c language Data Type Modifiers are keywords used to change the properties of current properties of data type.
Read more....
What is Storage Class in C ?
Storage class specifiers in C language tells to the compiler where to store a variable (Storage area of variable), how to store the variable, Scope of variable, Default value of a variable (if it is not initialized it), what is the initial value of the variable and life time of the variable.
Read more.......
No | Compiler | Interpreter |
1 | Compiler takes Entire program as input at a time. | Interpreter takes Single instruction as input at a time. |
2 | Intermediate Object code is generated | No Intermediate Object code is generated |
3 | It execute conditional control statements fastly. | It execute conditional control statements slower than Compiler |
4 | More memory is required. | Less memory is required. |
5 | Program need not to be compiled every time | Every time higher level program is converted into lower level program |
6 | It display error after entire program is checked | It display error after each instruction interpreted (if any) |
7 | Example: C | Example: BASIC |
What is buffer in C
Which data type supported by switch case ?
A switch statement work with byte, short, char and int primitive data type, it also works with enumerated types and string.
What is || operator ?
The || is also known as the OR operator in C programming. This operator is return true when at least one condition is true.
What is limitations with switch case ?
Logical operators can not be used with switch statement.
Why use getch()
It is a predefined function in "conio.h" (console input output header file) will tell to the console wait for some time until a key is hit given after running of program.
By using this function we can read a character directly from the keyboard. Generally getch() are placing at end of the program after printing the output on screen.
Difference between source code and object code.
Source code | Object code |
Source code is in the form of Text form. | Object Code is in the form of Binary Numbers. |
Source code is Human Readable Code. | Object Code is in Machine Readable formats. |
Source code is Generated by Human or Programmer. | Object Code is Generated by Compiler. |
Source code is receive Compiler as a Input. | Object Code is Generated by Compiler as a Output. |
Operator in C
What is Operator in C ?
Operator is a special symbol that tells the compiler to perform specific mathematical or logical Operation.
Read more......
What is the modulus operator ?
Modulus operator return remainder. The modulus operator is used for get the remainder if you divide any number by other number.
What is Ternary Operator ?
If any operator is used on three operands or variable is known as
Ternary Operator. It can be represented with
? : . It is also called as
conditional operator.
Read more....
Main advantage of Ternary operator ?
Using Ternary Operator reduce the number of line codes and improve the performance of application.
What is binary operator ?
Binary operator are used with two operands, example +, _ *, / operators are binary operators/
What is unary operator ?
Unary operators are those which are used with only on single or one operand, example ++, -- are unary operator
Control Statements in C
What is Decision Making Statement ?
Decision making statement is depending on the condition block need to be executed or not which is decided by condition.
What is else in C ?
It is a keyword, by using this keyword we can create a alternative block for "if" part.
Read more.....
Why use Loop ?
Where need repetition of same code a number of times at that place use Loop in place of writing more than one statements. The way of the repetition will be forms a circle that's why repetition statements are called loops.
Read more.......
When use Do-While Loop ?
When we need to repeat the statement block at least 1 time then we use do-while loop.
What is while Loop ?
In while loop First check the condition if condition is true then control goes inside the loop body other wise goes outside the body. while loop will be repeats in clock wise direction.
Read more.......
Difference between while and do..while loop ?
In while loop First check the condition if condition is true then control goes inside the loop body other wise goes outside the body. but in case of do..while loop at least one time loop will be execute then condition is checked.
Which loop have fast execution for or while ?
Execution process of while loop is slower than for loop
Error in C
What is error in C ?
Error is a abnormal condition whenever it occurs execution of the program is stopped these are mainly classified into following types.
- Compile time error
- Run time error
What is Compile time error in C
If any error is generated at the time of compilation is known as compile time error, in general these are raised while break down the rules and regulation of programming language.
What is Run time error in C
If any error is generated at run time is known as runtime error, in general these are raised because of writing wrong logic in the program.
What is warning in C
Warning is also an abnormal condition but whenever it occurred execution of program will never be stopped.
Difference between call by value and call by reference.
call by value | call by reference |
This method copy original value into function as a arguments. | This method copy address of arguments into function as a arguments. |
Changes made to the parameter inside the function have no effect on the argument. | Changes made to the parameter affect the argument. Because address is used to access the actual argument. |
Actual and formal arguments will be created in different memory location | Actual and formal arguments will be created in same memory location |
By default which type of function are use C to pass arguments ?
By default, C uses call by value to pass arguments.
Advance C
Why need of structure ?
In C language array is also a user defined data type but array hold or store only similar type of data, If we want to store different-different type of data in then we need to defined separate variable for each type of data.
Difference between Structure and Union
| Structure | Union |
1 | For defining structure use struct keyword. | For defining union we use union keyword |
2 | Structure occupies more memory space than union. | Union occupies less memory space than Structure. |
3 | In Structure we can access all members of structure at a time. | In union we can access only one member of union at a time. |
4 | Structure allocates separate storage space for its every members. | Union allocates one common storage space for its all members. Union find which member need more memory than other member, then it allocate that much space |
What is advantage of union over structure ?
It occupies less memory because it occupies the memory of largest member only.
What is disadvantage of union over structure ?
It can store data in one member only.
What is syntax error ?
Whenever any mistake are occurred at the time write programming code.
What is the use of a '\0' character ?
It is referred to as a terminating null character, It is generally used to show the end of a string value.
What is wrong with this statement ? name = "porter";
You cannot use the = sign to assign values to a string variable. For assign string value in variable, use the strcpy function like below
Example
strcpy(name, "porte");
File Handling
What is FILE ?
FILE is predefined data type, which is defined in stdio.h.
What is NULL in C ?
NULL is a macro which is defined in C header files. The value of NULL macro is 0.
What is dangling pointer in C ?
When a pointer is pointing to non-existing memory location is called dangling pointer.
What are preprocessor directives ?
Preprocessor is a program which will executed automatically before passing the source program to compiler. This process is called pre-processing.