- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
Operators in C Interview Questions & Answers - Learning Mode

Operators in C Interview Questions & Answers - Learning Mode

C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. Operators can be classified based on the type of operations they perform. Different types of operators in C are Arithmetic Operators, Relational Operators, Logical Operators, Assignment Operators, Increment and Decrements Operators, Conditional Operator, Bitwise Operators and Special Operators

Try Operators in C Interview Questions & Answers - Exam Mode

1 2 Next

Sort By : Latest First | Oldest First | By Rating

Operators in C Interview Questions & Answers - Learning Mode
Try Operators in C Interview Questions & Answers - Exam Mode
Question: When should a type cast not be used?

Answer: A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers can cause the program to fail to run correctly.

A type cast should not be used to turn a pointer to one type of structure or data type into another. In the rare events in which this action is beneficial, using a union to hold the values makes the programmer?s intentions clearer. Source:
Question: Write Addition of two numbers using Bitwise operators.

Answer: #include<stdio.h>

int main()
int a,b,sum, carry;
sum = a ^ b;
carry = a & b;
while (carry != 0)
carry <<= 1;
a = sum;
b = carry;
sum = a ^ b;
carry = a & b;

Question: Why n++ executes faster than n+1?

Answer: The expression n++ requires a single machine instruction such as INR to carry out the increment operation whereas, n+1 requires more instructions to carry out this operation. Source:
Question: What is a modulus operator? What are the restrictions of a modulus operator?

Answer: A Modulus operator gives the remainder value. The result of x%y is obtained by (x-(x/y)*y). This operator is applied only to integral operands and cannot be applied to float or double. Source:
Question: Why don't we add null pointer at the end of array of integer?How can we calculate the length of array of integer?

Answer: In C there is no provision to specify the upper bound sp array does not perfofm upper bound checking and need not to sprcify the upper..NULL check

Question: What is pointers and its uses?

Answer: Pointer is a variable which holds the address of the another variable.
for ex:int *p;
here p is a pointer which holds the address of inter variable.
uses of pointers:
1.To access array elements
2.Pointers use in dynamic memory allocation linked linked lists,trees,graphs.
3.Passing data in & out of without coping .
4.Create and manage your own data types.
Question: How we can add two numbers without using + symbol?

Answer: use logicalor(|) operation to add the numbers Source:
Question: When is a switch statement better than multiple if statements?

Answer: The switch statement is better than multiple if statements when there are more than two alternatives to be selected whether the case value matches to the variable of either character or integer type. Source:
Question: Write A Program With Out Using ;

Answer: void main()
int i;
if(printf("Program with out Semicolon"))
As Printf function return int(no of charecter),so The Value of i must be =0; And program should be work with out semicolon.

Question: How to add 2 numbers without + sign?

Answer: Ans is ::

make a try it will work
Question: Write a code for implementation of doubly linked list with use of single pointer in each node

Answer: Store an extra integer which stores the X-or value of addresses of previous node and the next node. Since you have the option of storing one pointer, you can easily retrieve the address of the other node {either previous or next} by performing X-or between the stored integer and the node address (stored one). Source:
Question: What is the use of Bitwise operators?
what is the use of unformatted Input/Output functions?

Answer: Bitwise and operator (&) is used to check that a particular bit is ON (1) or OFF (0) or to unset a particular bit and bitwise OR operator is used to set a particular bit of a constant. Source:
Question: Can math operations be performed on a void pointer?

Answer: No. Pointer addition and subtraction are based on advancing the pointer by a number of elements. By definition, if you have a void pointer, you don?t know what it?s pointing to, so you don?t know the size of what it?s pointing to. If you want pointer arithmetic to work on raw addresses, use character pointers. Source:
Question: How to convert decimal to octal and hexadecimal & binary using shift registers?

Answer: void main()
int i=12;
printf("i in integer form=%d
i in octal=%o,i in hexadecimal=%x",i,i,i);
Question: Assign a=56;how to separate that number(ie:5,6) and multiply(ie:5*6) using bitwise operator?

Answer: int b,c;
cout<<a; Source:
Question: How can i find size of a variable without using sizeof() operator?

Answer: #define any_size(any) (char*)(&any)-(char*)((&any)-1)

void main()


//any type of variable int c;


Question: Which bit wise operator is suitable for turning off a particular bit in a number ?

Answer: The bitwise AND operator, again. In the following code snippet, the bit number 24 is reset to zero.

some_int = some_int & ~KBit24; Source:
Question: How I can add two numbers in c language without using Arithmetic operators?

Answer: Sum = a xor b;
carry = a and b; Source:
Question: What is a const pointer?

Answer: The access modifier keyword const is a promise the programmer makes to the compiler that the value of a variable will not be changed after it is initialized. The compiler will enforce that promise as best it can by not enabling the programmer to write code which modifies a variable that has been declared const.

A ?const pointer,? or more correctly, a ?pointer to const,? is a pointer which points to data that is const
(constant, or unchanging). A pointer to const is declared by putting Source:
Question: How will you print % character?

Answer: printf(?%%?) will print %


1 2 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.03125 Seconds