| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| 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 |
| int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);
what is the o/p? | Verifone | 4 |
| how memory store byte
| Huawei | 3 |
| What is the main differences between C and Embedded C? | | 1 |
| How can I allocate arrays or structures bigger than 64K? | | 4 |
| What is the memory allocated by the following definition ?
int (*x)[10];
| ADITI | 3 |
| difference between my-strcpy and strcpy ? | Geometric-Software | 3 |
| What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
| IBM | 2 |
| write a program to swap Two numbers without using temp variable. | HP | 16 |
| 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 | 9 |
| f1()
{
f(3);}
f(int t)
{
switch(t);
{
case 2: c=3;
case 3: c=4;
case 4: c=5;
case 5: c=6;
default: c=0;}
value of c?
| Geometric-Software | 5 |
| what is the differance between pass by reference and pass
by value. | Infosys | 4 |
| 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? | | 3 |
| write a program to check whether a given integer is a strong
number or not?
[Hint:
145=1!+4!+5!
=1+24+120
=145]
| | 1 |
| write a code for large nos multilication (upto 200 digits) | Persistent | 1 |
| what is the diff between the printf and sprintf functions??
and what is the syntax for this two functions ?? | | 4 |
| Which of the following sorts is quickest when sorting the
following set: 1 2 3 5 4
1) Quick Sort
2) Bubble Sort
3) Merge Sort
| | 3 |
| consider the following C code
main()
{
int i=3,x;
while(i>0)
{
x=func(i);
i--;
}
int func(int n)
{
static sum=0;
sum=sum+n;
return(sum);
}
the final value of x is
| TCS | 2 |
| what is the difference between
const char *p, char const *p, const char* const p
| Accenture | 3 |
| what is the difference between declaration ,defenetion and
initialization of a variable? | LG-Soft | 4 |
| |
| For more C Interview Questions Click Here |