| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| WAP to accept rollno,course name & marks of a student &
display grade if total marks is above 200? | | 2 |
| fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
} | NDS | 13 |
| Look at the Code:
#include<string.h>
void main()
{
char s1[]="abcd";
char s2[10];
char s3[]="efgh";
int i;
clrscr();
i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd"));
printf("%d",i);
}
What will be the output?
A)No output B) A Non Integer C)0 D) Garbage
| Accenture | 5 |
| fn f(x)
{ if(x<=0)
return;
else f(x-1)+x;
}
| HCL | 3 |
| char S;
char S[6]= " HELLO";
printf("%s ",S[6]);
output of the above program ?
(0, ASCII 0, I,unpredictable)
| Mascot | 6 |
| 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 |
| main()
{
int a=0;
if(a=0) printf("Ramco Systems\n");
printf("India\n");
}
output? | Ramco | 6 |
| find the output of the following program
main()
{
int x=5, *p;
p=&x;
printf("%d",++*p);
}
| TCS | 4 |
| find second largest element in array w/o using sorting
techniques? use onle one for loop. | Zycus-Infotech | 2 |
| what is difference between array and structure?
| TCS | 19 |
| Write a routine that prints out a 2-D array in spiral order! | Lucent | 1 |
| Write a program to compute the following
1!+2!+...n! | | 3 |
| int *a[5] refers to | TCS | 8 |
| main is a predefined or user define function
if user defined why?
if predefined whay? | TCS | 2 |
| what is calloc and malloc? | | 1 |
| what is const volatile? | | 1 |
| why the execution starts from main function | | 9 |
| Can we include one C program into another C program if yes how? | Infosys | 4 |
| How to reverse a string using a recursive function, without
swapping or using an extra memory? | Motorola | 18 |
| What is the output for the program given below
typedef enum grade{GOOD,BAD,WORST,}BAD;
main()
{
BAD g1;
g1=1;
printf("%d",g1);
}
| ADITI | 3 |
| |
| For more C Interview Questions Click Here |