# C Interview Questions and Answers

**Home**>

**Technical Interview Q&A**>

**C**>

**Q & A**

*Accenture (161)*

*Adobe (2)*

*Alcatel-Lucent (1)*

*Broadcom Ltd (1)*

*Wipro (84)*

*Virtusa (220)*

*IBM (35)*

*Aricent (47)*

*Tech Mahindra (13)*

*TCS (170)*

*Capgemini (32)*

*iGate (162)*

*Syntel Inc. (175)*

*AT&T (1)*

*Cisco (107)*

*Sapient (72)*

*Sopra Steria (138)*

*Societe Generale (75)*

*Goldman Sachs (5)*

*TCS NQT (7)*

*Huawei (11)*

*Wipro NLTH (36)*

**#**C (123)

**#**C++ (184)

**#**DBMS (143)

**#**Soft. Engineering (77)

**#**Python (2)

**#**Finite Automata (6)

**#**SQL (106)

**#**Java (66)

**#**.NET (112)

**#**WebMethod (166)

**#**EDI (40)

**#**Informatica (94)

**#**Oracle Apps HRMS (106)

**#**Operating System (89)

**#**Data Structure (66)

**#**PHP (1)

**#**Unica (0)

**#**Oracle Apex (0)

**#**HR Question in TR (122)

**#**Networking (61)

**#**Hadoop (2)

**#**HTML (1)

**#**Oracle PLSQL (31)

**#**DPDK (Data Plane Development Kit) (40)

21 / 123

**Answer:**

For loop is used when we know how many times

**Please Login First :**

22 / 123

**Answer:**

to check if the ith bit is on or off in a number n following bitwise operation is used.

flag = n&(1<<i) ;

if the value of flag is zero then the bit is set otherwise not.

explanation of above approach is as follows.

1. lets assume n is 9 so its bitwise operator is 1001 and bitwise representation of 1 is 0001

2.to check if 4th bit is on we do left shift by 4 on 1 (1<<4) which shift the bits in one to left by 4 unit now the (1<<4)=1000

3.Finally bitwise and operation is performed so 1001&1000 = 1000 which is not zero so it means that 4th bit of 9 is set

**Please Login First :**

23 / 123

**Answer:**

The** bitwise operator xor i.e '^'** is used to turn off a particular number

by performing the following operations say we want to turn the ith bit off in a number n

then n = n^(1<<i)

**Please Login First :**

24 / 123

**Answer:**

multiplying a number by two is equivalent to bitwise left shift of a number by 1 for eg

1 has a binary representation as 00001 left shift by 1 will make it 00010 which is 2.

right shift is equivalent to divide a number by 2 .

left shift is equivalent to multiply a number by 2.

**Please Login First :**

25 / 123

**Answer:**

Enumarations are list of integer constants, by default value is zero.

**Please Login First :**

26 / 123

**Answer:**

Structure is a function which contains different types of data types and allocation different memory location.

**Please Login First :**

27 / 123

**Answer:**

Structure- It is an user defined data function that allow to store multiple type of data in a single unit.

It occupies sum of memory of all location.

Whereas, Union- It is also an user defined data function that allow to store multiple type of data in a single unit.

But it occupies memory of largest member only.

**Please Login First :**

28 / 123

**Answer:**

1.memory.

2.easy to declare.

**Please Login First :**

29 / 123

**Answer:**

No Discussion on this question yet!

**Please Login First :**

30 / 123

**Answer:**

#include<stdio.h>

struct name{

int a;

int b;

int c;

};

struct name func(){

struct name s1 ;

s1.a=1;

s1.b=2;

s1.c=3;

return s1;

}

int main(){

struct name val = func();

}

**Please Login First :**

Frequently asked **C Interview Questions and Answers** at Freshers and experience level. All Question are based on the real time experience of previous candidates. You can search and filter the question set by company name from the tag cloud.

Q4I Collection of **C Programming Interview Questions and Answers with Explanations** asked in campus/off-campus interviews, walk-in interview and various IT companies Interview at Freshers & Experienced level. Multiply your selection chance by practicing the C Interview Question from basic to Standard, or by going through Company specific pattern of question asked from C Programming.

So, next time, when you prepare for a company's interview, please check your knowledge against these C language technical interview questions and answers.