| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| How to write a code for random pick from 1-1000 numbers?
The output should contain the 10 numbers from the range
1-1000 which should pick randomly, ie ,for each time we run
the code we should get different outputs. | NetApp | 12 |
| Give a method to count the number of ones in a 32 bit number? | | 1 |
| Write a C program that reads a series of strings and prints
only those ending in "ed" | | 2 |
| I have a function which accepts a pointer to an int. How
can I pass a constant like 5 to it? | | 3 |
|
main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n",x,y);
}
output?? | Ramco | 13 |
| Suppose I want to write a function that takes a generic
pointer as an argument and I want to simulate passing it by
reference. Can I give the formal parameter type void **, and
do something like this?
void f(void **);
double *dp;
f((void **)&dp);
| | 1 |
| print ur name without using any semicolon in c/c++.... | | 6 |
| main()
{
int i,j,A;
for(A=-1;A<=1;A++)
prinf("%d\t",!!A);
} | | 5 |
| f=(x>y)?x:y
a) f points to max of x and y
b) f points to min of x and y
c)error
| HCL | 4 |
| How do you write a program which produces its own source
code as its output? | | 3 |
| n=7623
{
temp=n/10;
result=temp*10+ result;
n=n/10
}
| Wipro | 4 |
| In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory? | | 4 |
| Which of the following about automatic variables within a
function is correct ?
a.its type must be declared before using the variable
b.they are local
c.they are not initialised to zero
d.they are global.
| TCS | 3 |
| write an algorithm which can find the largest number among
the given list using binary search ...............
this was asked in the interview | Satyam | 2 |
| Which is not valid in C?
1) class aClass{public:int x;}
2) /* A comment */
3) char x=12;
| | 5 |
| a=0;
while(a<5)
printf("%d\n",a++);
how many times does the loop occurs?
a.infinite
b.5
c.4
d.6
| TCS | 5 |
| What is #pragma directive?how it is used in the program?
what is its advantages and disadvantages? | | 1 |
| what is op?
for(c=0;c=1000;c++)
printf("%c",c); | Trigent | 18 |
| Write a program to write a given string in maximum
possibilities?
i.e str[5]="reddy";
i.e we can write this string in 120 ways
for that write a program | Subex | 3 |
| what is the value of 'i'?
i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")
| Cadence | 4 |
| |
| For more C Interview Questions Click Here |