C Language Operators Interview Questions


Interview Questions as well as Answers on Operators inward C Language 

1. What is an Operator?
 

An operator is a symbol which helps the user to ascendance the estimator to practise a for sure mathematical or logical manipulations.

Operators are used inward C linguistic communication programme to operate on information as well as variables.

2. What are the dissimilar types of Operators inward C language?
 

C has a rich gear upwards of operators which tin sack live on classified as,

•Arithmetic operators
•Relational Operators
•Logical Operators
•Assignment Operators
•Increments as well as Decrement Operators
•Conditional Operators
•Bitwise Operators

3. What is meant yesteryear Precedence of operators?
 

If to a greater extent than than i operator is involved inward an facial expression then, C linguistic communication has predefined dominion of priority of operators. This dominion of

priority of operators is called operator precedence.

In C, precedence of arithmetics operators(*,%,/,+,-) is higher than relational operators(==,!=,>,<,>=,<=) as well as precedence of relational

operator is higher than logical operators(&&, || as well as !).

4. What is meant yesteryear Associativity of Operators?
 

Associativity indicates inward which club 2 operators of same precedence (priority) executes.

The associativity of operators tin sack live on of 2 types:

•Left associativity
•Right associativity

Left associativity of operators is by as well as large applied to binary operators as well as it is used when nosotros desire to grouping the facial expression from left

to right.

Right associativity of operators is applied when nosotros desire to grouping from correct to left as well as usually used alongside unary operators.

5. Define Operand?
 

An operand is the role of a estimator education that specifies information that is to live on operating on or manipulated and, yesteryear extension, the

data itself.

Basically, a estimator education describes an functioning (add, subtract, as well as thence forth) as well as the operand or operands on which the

operation is to live on performed.

6. Define Expression?
 

An facial expression is a declaration that states an functioning on data.

Suppose for instance inward a mathematical facial expression similar (a+b-c), nosotros tin sack uncovering that nosotros are performing add-on as well as subtraction on a, b &

c collectively.

So the add-on as well as subtraction operations are done yesteryear + as well as – operators as well as that whole declaration is known every bit an expression.

7. What are Arithmetic operators inward C language?
The arithmetics operators are used for addition, subtraction, multiplication, division, modulus etc.

These are rattling basic mathematical operations that are rattling usually required inward our programs.

Almost all the symbols required to stand upwards for them are similar to normal mathematical notations alongside slight difference.

8. Define Integer arithmetics operator inward C language?
When an arithmetics functioning is performed on 2 whole numbers or integers than such an functioning is called every bit integer arithmetic. It

always gives an integer every bit the result.

9. Define Floating dot arithmetics inward C language?
When an arithmetics functioning is preformed on 2 existent numbers or fraction numbers such an functioning is called floating dot

arithmetic.

The floating dot results tin sack live on truncated according to the properties requirement.

The residuum operator is non applicable for floating dot arithmetics operands.

10. Define mixed means arithmetics inward C language?
When i of the operand is existent as well as other is an integer as well as if the arithmetics functioning is carried out on these 2 operands thence it is

called every bit mixed means arithmetic. If anyone operand is of existent type thence the lawsuit volition ever live on real.

11. What is the modulus operator?
The modulus operator outputs the residuum of a division. It makes exercise of the pct (%) symbol.

12. What are the restrictions of a modulus operator inward C?
There is a restriction inward C linguistic communication piece using the modulus operator.

There are 3 types of numerical information types namely integer, float as well as double. But modulus operator tin sack operate alone on integers as well as

cannot operate on floats or double.

If anyone tries to exercise the modulus operator on floats thence the compiler would display mistake message every bit ‘Illegal exercise of Floating

Point’.

13. What are Relational operators inward C language?
Relational operators are basically used inward conditional as well as looping statements. They banking concern check for relation betwixt variables or betwixt

variables as well as constants. After they are used, they supply 0 if the lawsuit is fake as well as supply 1 if the lawsuit is true.

A unproblematic relational facial expression contains alone i relational operator.

14. What are Logical operators inward C language?
Sometimes nosotros must receive got passed through logic gates similar AND, OR, NOT. Similarly inward C nosotros tin sack brand exercise of logical operators similar to

the functioning of And, Or, Not. Logical operators mainly operate alongside the values 0 & 1.

Basically inward a C program, whatsoever non- zero value is treated every bit truthful as well as zero value is treated every bit false.

15. What are Assignment operators inward C language?
The Assignment Operator evaluates an facial expression on the correct of the facial expression as well as substitutes it to the value or variable on the left

of the expression.

For example,

x = a + b

Here the value of a + b is evaluated as well as substituted to the variable x.

In addition, C has a gear upwards of shorthand assignment operators of the form.

var oper = exp;

Here var is a variable, exp is an facial expression as well as oper is a C binary arithmetics operator. The operator oper = is known every bit shorthand

assignment operator

16. What are increment as well as decrement operators inward C language?
The increment as well as decrement operators are i of the unary operators which are rattling useful inward C language. They are extensively used inward

for as well as piece loops. The syntax of the operators is

•    ++ variable lift
•    variable name++
•    – –variable lift
•    variable name– –

The increment operator ++ adds the value 1 to the electrical flow value of operand as well as the decrement operator – – subtracts the value 1 from

the electrical flow value of operand. ++variable lift as well as variable name++ hateful the same affair when they cast statements independently, they

behave differently when they are used inward facial expression on the correct manus side of an assignment statement.

17. What are conditional or ternary operators inward C language?
The conditional operator is too known every bit ternary operator. It is called ternary operator because it takes 3 arguments. The

conditional operator evaluates an facial expression returning a value if that facial expression is truthful as well as dissimilar i if the facial expression is

evaluated every bit false. It plant from left to right.

18. What is the exercise of bitwise operators inward C language?
The smallest chemical component inward retentiveness on which is able to operate is called byte; as well as the programming languages are byte oriented. One of the

c powerful features is a gear upwards of fleck manipulation operators. The bitwise operator performs the functioning on bits (i.e. fleck yesteryear bit).

Using the bitwise operators nosotros tin sack gear upwards / reset / banking concern check whatsoever fleck inward the value of the variable.

There are 3 types of bitwise operator.

•    Bitwise AND(&)
•    Bitwise OR(|)
•    Bitwise Exclusive OR(^)

Bitwise AND operator: The output of logical AND is 1 if both the corresponding bits of operand is 1. If either of fleck is 0 or both

bits are 0, the output volition live on 0. It is a binary operator (works on 2 operands).

Bitwise OR operator: The output of bitwise OR is 1 if either of the fleck is 1 or both the bits are 1.

Bitwise XOR(exclusive OR) operator The output of bitwise XOR operator is 1 if the corresponding bits of 2 operators are opposite

(i.e., To cash inward one's chips corresponding output fleck 1; if corresponding fleck of outset operand is 0 then, corresponding fleck of instant operand should

be 1 as well as vice-versa.).

19. What is sizeof () operator?
The operator size of gives the size of the information type or variable inward price of bytes occupied inward the memory. The operand may live on a

variable, a constant or a information type qualifier.

The size of operator is usually used to create upwards one's hear the lengths of arrays as well as structures when their sizes are non known to the

programmer. It is too used to allocate retentiveness infinite dynamically to variables during the execution of the program.

20. What is comma operator?
The comma operator tin sack live on used to link related expressions together. H5N1 comma-linked listing of expressions is evaluated left to correct as well as

value of correct to a greater extent than or less facial expression is the value of the combined expression.

21. What is an L-value?
An L-value is an facial expression to which a value tin sack live on assigned.

The L-value facial expression is located on the left side of an assignment statement, whereas an R-value is located on the correct side of an

assignment statement. Each assignment declaration must receive got an L-value as well as an R-value.

The L-value facial expression must reference a storable variable inward memory. It cannot live on a constant.

22. What is an R-value?
R-value tin sack live on defined every bit an facial expression that tin sack live on assigned to an L-value. The R-value appears on the correct side of an assignment

statement.

Unlike an L-value, an R-value tin sack live on a constant or an expression

An assignment declaration must receive got both an L-value as well as an R-value.

23. What is arrow operator?
In C programming nosotros exercise arrow operator to access construction fellow member using the pointer variable.

Whenever nosotros declare construction variable thence fellow member tin sack live on accessed using the dot operator. But when pointer to a construction is used

then arrow operator is used.

24. What is unary operator?
Unary Operators are those operators which operate on 1 operand like/example a++, ++a,--b etc. The letters a, b are called operands as well as

++, -- are called every bit Operators.

25. What is binary operator?
A type of operator that plant alongside 2 operands is known every bit binary operators.

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post