| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| class foo {
public:
static int func(const char*& p) const;
};
This is illegal, why? | Google | 6 |
| write the program for prime numbers? | TCS | 7 |
| What is encapsulation? | | 1 |
| 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 | 2 |
| 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?? | | 2 |
| what are the difference between ANSI C and Let Us c and Turbo C | | 1 |
| How can I set an array's size at run time? | | 7 |
| what is meant by c | | 4 |
| Why doesn't C have nested functions? | | 1 |
| Give a fast way to multiply a number by 7 | Microsoft | 8 |
| 2)#include<iostream.h>
main()
{
printf("Hello World");
}
the program prints Hello World without changing main() the
o/p should
be
intialisation
Hello World
Desruct
the changes should be
a)iostream operator<<(iostream os, char*s)
os<<'intialisation'<<(Hello World)<<Destruct
b) c) d)none of the above | Siemens | 4 |
| HOW DO YOU HANDLE EXCEPTIONS IN C?
| AppLabs | 2 |
| 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 |
| why TCS selected more student in the software field from
all institution. | TCS | 3 |
| what will be the result of the following program ?
char *gxxx()
{
static char xxx[1024];
return xxx;
}
main()
{
char *g="string";
strcpy(gxxx(),g);
g = gxxx();
strcpy(g,"oldstring");
printf("The string is :
%s",gxxx());
}
a) The string is : string
b) The string is :Oldstring
c) Run time error/Core dump
d) Syntax error during compilation
e) None of these
| IBM | 2 |
| main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
| CitiGroup | 3 |
| regarding the scope of the varibles;identify the incorrect
statement:
a.automatic variables are automatically initialised to 0
b.static variables are are automatically initialised to 0
c.the address of a register variable is not accessiable
d.static variables cannot be initialised with any expression
| TCS | 1 |
| how to find that no is int or float? | | 4 |
| how does the for loop work actually..suppose for the
following program how it ll work plz explain to me
for(i=5;i>=0;i--)
prinf(i--); | RMSI | 13 |
| write a program to sort the elements in a given array in c
language | | 2 |
| |
| For more C Interview Questions Click Here |