c programming || Short Answer || Terminal

2nd Semester

Asian  Balkumari HDC Indreni Kanya NCC NISt


Define symbolic constant and comma operator ?
symbolic constant is name that substitute for a sequence of character that cannot be changed. The comma operator is a binary operator that evaluates its first operand and discards the result, it then evaluates the second operand and returns this value (and type).
Differentiate among compile time , run time & logical error.
Compile Time :-  It is first process of c programming which checks the program while compilation.
Run Time :- It is time which is taken to check the program wheather the program has any error or not.
 Logical Error :- A logic error is a mistake in a program’s source code that results in incorrect or unexpected behavior
Why C language is popular ?
C language is popular because of following terms : 

  • One of the very strong reasons why C programming language is so popular. 
  • C is good choice for system level programming. 
  • so widely is the flexibility of its use for memory management

Differentiate among 1,1.0,’1’and “1”.
1 is a number and it is integer type. 1.0 is decimal number and is of float data type, ‘1’ is a character type ,”1″ is string statement. 5
Define operator precedence & associativity with example.
 Operator precedence determines which operator is performed first in an expression with more than one operators with different precedence. For example: ‘*’ and ‘/’ have same precedence and their associativity is Left to Right, so the expression “100 / 10 * 10” is treated as “(100 / 10) * 10”
Differentiate Prefix & Postfix operator.
Prefix:-  In programming increm ent ++ operator increases the value of a variable by 1 and decrement — operator decreases the value of a variable by 1.
Suppose, a = 5 then,
++a; //a becomes 6
–a; //a becomes 6
Postfix :- The result of the postfix increm ent or decrement operation is the value of the operand.
Suppose, a = 5 then, 
a++; //a becomes 7
a–; //a becomes 5
Define escape sequence with example.
An escape sequence refers to a combination of characters beginning with a back slash (\) followed by letters or digits. Escape sequences represent nonprintable and special characters in character and literal strings. \n \t \b etc are examples of escape sequence.
What is mean by automatic type conversion?
There are two types of type conversion: Implicit Type Conversion. Also known as ‘automatic type conversion’. Done by the compiler on its own, without any external trigger from the user. Generally takes place when in an expression more than one data type is present.
Explain the use of break and continue with example.
 When a break statement is encountered, it terminates the block and gets the control out of the switch or loop. When a continue statement is encountered, it gets the control to the next iteration of  the loop. A break causes the innermost enclosing loop or switch to be exited immediately.
Explain ternary operator with example.
Ternary operator is conditional operator in which there is three expressions. Where first expression is true then it is executed but false the it checks secound expression and if it is true it is executed again it is false then third expression is executed Eg: exp1?exp2:exp3. 11
Differentiate between signed & unsigned integer.
 Both can store 256 different values, but signed integers use half of their range for negative numbers, whereas unsigned integers can store positive numbers that are twice as large. An n-bit unsigned variable has a range of 0 to (2n)-1. … An integer without a sign (an unsigned integer) assumes all values are positive.


Can while statement end with a semicolon?

  • No, while statement can’t end with a semicolon.

Why is stdio.h file used in c-program ?

  • h file is used in c-program because to declared input/output function.

Define variable.

  • It is a memory location that can hold a value of a certain data type.


Who developed C language?
Ans:-Dennis Ritchie developed c language.
What is the range value of integer constant?
Ans:- The range value of integer constant is -32767 to  32767.
Define #define preprocessor directive.
Ans:- #define preprocessor directive is a pre-processor which is used to define the value of variable.
What is global variable?
Ans:- Global variable has global scope rather than local scope & it can be used throughout the program.
What is assembler?
Assembler is the language processor which is used to translate program written in assembly language into machine code.
what is constant?
Ans:- The value that doesnot change during the execution of the program is called constant.
When is void keyword used?
Ans:- Void keyword is used when a function doesnot return any value.
What is type casting?
Ans:-  Type casting is the type conversion in which there are different ways of changing an expression from one data type to another.
Which escape character can be used to backslash in c?
Ans:- ‘//’ escape character can be used to backslash in c.
What does this line do scanf(“%d”,&i);?
     Ans:- The scanf(“%d”,&i); accepts an integer value and   points that value to the variable i.
Why is getch() function used?
Ans:- getch() function is used with conio.h library in order to hold the screen for displaying the output.
What is meant by object file?
Ans:- An object file is a file containing object code, meaning relocatable format machine code that is usually not directly executable.
 What is the difference between the float & double variable?
Ans:- The float variable use %f data type identifier and it is of 4 byte whereas double variable use %d data type identifier and it is of 8 byte.
 Why do you need to put comments into your program?
Ans:- We need to put comments in the program to know what does the line does in a program & used for single & double line comment.
Why is the main() function needed in your program?
Ans:-  The main() function needed in our program because without main() function program cannot be executed.


Consider an arr[5][2]. How many int data can be stored into that array ?

  • 5*2=10 elements
  • 10*2=20 byte data can be stored into arr[5][2].

Define return statement with examples.

  • The return statement terminates the execution of a function and returns control to the calling function.
For eg:
void main()
    float a,b;
    printf("enter any two number: ");
    printf("\n sum is %f",a+b);
    printf("\n difference is %f",a-b);
    return 0;

What is the use of break statement in switch statement/

  • The use of break statement in switch is it acts as stopping point or it helps to execute the program.

When you pass an argument to a function, what is actually being passed ?

  • The value of variable is passed when we pass an argument to a function.

Is it mandatory to write #include<math.h> provided no functions in the corresponding header file is used ?
No, it is not mandatory to write #include<math.h> provided no functions in the corresponding header file is used.
Explain conditional operator.

  • The conditional operator evaluates an expression returning a value if that expression is true and different one if the expression is evaluated as false. It is called ternary operator because it takes three arguments.


Define operator.
It is a symbol or sign that operates on single or multiple data items and tells the computer or compiler to perform certain operator on one or more data items.
2. Define Variables.
A variable is an identifier i.e. use to represent a single data items.
3. Define keywords.
Keyword are the predefine words having fix meaning which cannot be change in C programming.
4. What is escape sequence operator?
Escape Sequence operator is non-printing character used in C consisting of a back slash (\) followed by a letter or digit.
5. List 4 types of operator.
i. Arithmetic operator ii. Relational operator iii. Logical operator  iv. Conditional operator
6. Two advantage of C programming.
i. It has as ability to extend itself. ii. Highly portable language.
7. Syntax of print ():-
Printf (“control string”, arg1, arg2, …, argn);
8. Types of logical operator.
i. &&- logical AND ii. ||-logical OR iii. !- logical NOT
9. What is meaning of & in scanf ()?
Meaning of & in scanf () is argument are preceded by & (ampersand) to denote memory address.


1.What is variables?
Ans:-Variables is the type of data which declares its data types during the phase of coding.
2.How to find the size of data type,explain with syntax?
Ans:-To find the size of data type we have to give the input of the data size by typing printf.
Eg:- printf(“Result is %d”,(size of datatype);
3.What is Escape sequence?Give example.
Ans:-Escape sequence is the function of C which executes the file in the next space or space the programme in a systematic form. 
Eg:-Printf(“I am m\n”)
4.What is Increment and Decrement operator?
Ans:-Increment and decrement operstors are the operators which helps us to find the increment and decrement of a certain function or programme.Such as;a++,a—etc
a++=It sum 1 to a
a–=It difference 1 to a
5.Why precedence and associativity type conversion and explicit type conversion?
Ans:-Precedence and associativity are necessary in operators of knowing which number or which symbols should be done first or kept in priority .It is necessary for operator because it helps in giving correct answer as it prioritized the symbols which should be done first and step by step.
6.Differentiate between Automatic type conversion and explicit type conversion?
Ans:-The difference between the Automatic type conversion and explicit type conversion;

Automatic type Explict type
_It is the type of conversion which is done by the compiler itself. _It is the type of conversion which is forced by the user to perform by the compiler.
_Sum=a+b _Sum=(float)a+(float)b

7.How bitwise operators manipulate the data?
Ans:-Bitwise operator manipulates the data by moving the bit in the left side or right side.It can only be done in integers.
8.How can you define symbolic constants?Give example.
Ans:-Symbolic constant is that which is defined using the preprocessor and the constant can be used in whole function in a program.
9.Write and explain general form(syntax) of gets() and puts()?
gets(s) is done for giving the input in the string where as put(s)is done for giving the output in the string.
10.What is compiler?
Ans:-Compiler is a program or software which is used for changing the language in a machine understanding form.


When is void keyword use?
Void keyword is used when we don’t have to return any values.
How does an constant defined from const keyword differs from constant defined by pre-processor statement #define?
Constant defined from keyword const  is different from constant defined by #define is const keyword is used to declare values with string while #define is used to declare value of an identifier.
What is type conversion?
Type casting is a way to convert a variable from one data type to another data type. For example, if you want to store a ‘long’ value into a simple integer then you can type cast ‘long’ to ‘int’.
What is keyword?
Keywords are predefined reserved words used in programming that have special meanings to the compiler.
List the primary data type in C Program.
char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers.
int: As the name suggests, an int variable is used to store an integer.
float: It is used to store decimal numbers (numbers with floating point value) with single precision.
double: It is used to store decimal numbers (numbers with floating point value) with double precision.
What is Operator? List its types.
An operator is a symbol that tells the compiler to perform specific mathematical or logical functions. C language is rich in built-in operators and provides the following types of operators −

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators

What is pre-processor directive?
Before a C program is compiled in a compiler, source code is processed by a program called preprocessor. Commands used in preprocessor are called preprocessor directives and they begin with “#” symbol.
DIfferntiate between while and do while
The main difference between a while loop and do while loop is that while loop check condition before iteration of the loop, whereas do-while loop, checks the condition after the execution of the statements inside the loop.
What is control structure?
Control structures are the statements that control the flow of the source code. 
What is purpose of conditional operator?
Conditional operator are used as backup of if or if else statement.