| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| What will be the result of the following program?
main()
{
char p[]="String";
int x=0;
if(p=="String")
{
printf("Pass 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
else
{
printf("Fail 1");
if(p[sizeof(p)-2]=='g')
printf("Pass 2");
else
printf("Fail 2");
}
}
a) Pass 1, Pass 2
b) Fail 1, Fail 2
c) Pass 1, Fail 2
d) Fail 1, Pass 2
e) syntax error during compilation
| IBM | 10 |
| Write a c code segment using a for loop that calculates and
prints the sum of the even integers from 2 to 30, inclusive? | | 2 |
| How to receive strings with spaces in scanf() | | 4 |
| who is the founder of c | HP | 9 |
| write a program for size of a data type without using
sizeof() operator? | | 7 |
| which one of follwoing will read a character from keyboard
and store in c
a)c=getc()
b)c=getchar()
c)c=getchar(stdin)
d)getc(&c)
e)none | | 5 |
| 52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2? | | 6 |
| 52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2? | | 5 |
| write a C code
to reverse a string using a recursive function, without
swapping or using an extra memory.
| Motorola | 2 |
| HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I
NEED AN ANSWER THAT IMPRESS THE INTERVIEWER | | 2 |
| Please list all the unary and binary operators in C. | | 1 |
| pgm in c to reverse string by word using array(god is love
becomes love is god)
(no additional array can used,space is only delimiter
between words ) | Persistent | 1 |
| Write a function that accepts two numbers,say a and b and
makes bth bit of a to 0.No other bits of a should get
changed. | Scientific-Atlanta | 2 |
| Given an array of characters which form a sentence of
words, give an efficient algorithm to reverse the order of
the words (not characters) in it? | | 3 |
| who will call your main function in c under linux? | | 2 |
| what is the difference between getch() and getchar()? | | 5 |
| Is there any restriction in how many arguments printf or
scanf function can take?
in which file in my c++ compiler i can see the code for
implementation of these two functions?? | | 3 |
| pgm to reverse string using arrays i.e god is love becomes
love is god)
(assumption:only space is used for seperation of words)
no addtional memory used.i.e no temporary arrays can used. | Persistent | 4 |
| main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++;
printf("%d", num[i]);
}
what will be the output?
} | NDS | 15 |
| difference between my-strcpy and strcpy ? | Geometric-Software | 3 |
| |
| For more C Interview Questions Click Here |