| Back to Questions Page |
| |
| Question |
Name the language in which the compiler of "c" in written? |
Rank |
Answer Posted By |
|
Question Submitted By :: Abhinav Singh |
| This Interview Question Asked @ Bajaj |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | an ANSI type of compiler if you type in the name of a file
that hold C source  |
| Pappu Kumar Sharma |
| |
| |
| Question |
what is use of loop? |
Rank |
Answer Posted By |
|
Question Submitted By :: Hariprasath.s |
| This Interview Question Asked @ Infosys |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | 1) loop is a special provisions made in various programming languages in which we travel through till a certain condition is reached ....
2) whenever we have to print certain number of values repeatedly or constantly we can go for looping structures...
3) whenever a certain same operations has to be performed for different values consecutively we go for looping.....
thank u  |
| Vignesh1988i |
| |
| |
| Answer | by the help of loop we run the part of program many times with in the a specific condition. that part of program have a range it close in special sign({.......}).  |
| Yashvir Yadav |
| |
| |
|
|
| |
| Answer | we use loop when we want the given condition is checked
contineously.
 |
| Guest |
| |
| |
| Answer | 1)loop is used to perform a particular task till the given
condition is correct.
2)to run the program effiecently and effecttively.  |
| Lakshmi |
| |
| |
| Answer | run a part of a programme till the specified condition is
satisfied
instead of doing each&every time for printing some values
we use loop,so time saving  |
| Uma Maheswari |
| |
| |
| Answer | loops are used at times when we need to repeatedly check a
condion or during in situations when we need to execute
statements again and again as we need.  |
| Guest |
| |
| |
| Question |
can we write a program in c for printf and scanf without
using header file stdio.h |
Rank |
Answer Posted By |
|
Question Submitted By :: Sandhya Rishikesan |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | ya sure we can write ur own coding for printf & scanf functions.... but writing a function for the two is not that much easy ... in printf we must write our coding such that we have to have contact with VGA ( video graphic application) etc etc....
thank u  |
| Vignesh1988i |
| |
| |
| Question |
How can we see the Expanded source code and compiled code
for our source program in C? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vsankar08 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | go to command prompt change the directory in which the
program exist and then type command
cpp programname.c
it will generate programname.i file
that's the expanded source code
//KEEP IT DIRTY  |
| Rajesh Jat |
| |
| |
| Question |
for(i=0;i=printf("Hello");i++);
printf("Hello");
how many times how will be printed????????? |
Rank |
Answer Posted By |
|
Question Submitted By :: Minakshi |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | here the basic thing we must understand is that :
printf(); is a function. this printf() always returns the
number of character it processes inside " ".......here it
will return 4 according to me... this will will be assigned
to i and everytime 'i' will be a non zero value always and
also a semicolon is placed after for statement , so compiler
takes that has the next line and PRINTS "HELLO" INFINITELY
since 'i' value is always non zero or always TRUE...
and there is no way for the second printf() to get printed
according to me.........
thank u  |
| Vignesh1988i |
| |
| |
| Answer | Infinite times
i =printf("Hello");
here printf("hello") will return 5 i.e i=5 which will always
remain true that's why hello will be printed infinate times.  |
| Ruchi |
| |
| |
| Answer | for(i=0;i=printf("Hello");i++);
means
for(i=0;i=printf("Hello");i++)
{
}
thats why it will print Hello only one time.  |
| Asit Mahato |
| |
| |
| Answer | "Hello" will be printed infinite time.......  |
| Anandi |
| |
| |
| Question |
for(i=1;i>0;i++);
printf("i=%d",i);
what will be the answer???? |
Rank |
Answer Posted By |
|
Question Submitted By :: Minakshi |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | since after the loop there is a semicolon , so according to
the compiler this semicolon will be taken as next line and
the loop will be iterating till the termination condition....
output possibilities :
1)if the variable 'i' which is used as an signed integer
variable , this will take an infinite values and stop at one
instance and it will terminate the application. but wont
display anything in the screen
2) if this is an unsigned variable this will be infinite
with values going on and on without stopping.. but not
displaying it...
conclusion : loop is infinite here.....
thank u  |
| Vignesh1988i |
| |
| |
| Answer | after for lop,there is a semicolon.it means loop terminate
here..condition inside the loop will always true.so it will
be an infinite loop..nothing will be printed on the screen.
for next statement there will be printed any garbage value...  |
| Ankit Shekhavat |
| |
| |
| Answer | i is a signed integer
it will print only and only -32768
//KEEP IT DIRTY  |
| Rajesh Jat |
| |
| |
| Answer | 4
 |
| Guest |
| |
| |
| Answer | ans is i=2  |
| Naren |
| |
| |
| Answer | i=1i=1etc.  |
| Guest |
| |
| |
| Question |
we all know about the function overloading concept used in
C++ and we all learnt abt that.... but that concept is
already came in C in a very smaller propotion ... my
question is IN WHICH CONCEPT THERE IS A USE OF FUNCTION
OVERLOADING IS USED in C language????????????? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vignesh1988i |
| This Interview Question Asked @ Google |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Function Overloading or Polymorphic Behaviour for C
functions can be seen for those functions who accept
variable number of arguments.
They can take any number of arguments and any type of
arguments, its upon the programmer or the code inside it,
that decides what it wants those arguments to be , int ,
char ,float or something else..
ALthough it is not seperate function that runs for different
number and types of arguments, still for the user, a
function will be provided for different types of list of
input parameters, all being sent to the same ('name of the
')function..
#include <stdarg.h>
enum data_type{ TYPE_INT=0,TYPE_STRING=1};
int max( int num_of_arguments,...)
{
va_list arg_list;
va_start(arg_list, num_of_arguments);
data_type type=va_arg(arg_list,data_type);
if(type=TYPE_INT)
{
int max =0,i;
for(i = 2; i <= num_of_arguments; i++)
{
if((a = va_arg(arg_list, int)) > max)
max = a;
}
}
else
{
//do whaterver..
}
va_end(arg_list);
}  |
| Sandeep |
| |
| |
| Answer | In c also we are allowed to function overloading with
parameters wherever we like.  |
| Venkatesh |
| |
| |
| Question |
size maximum allocated by calloc() |
Rank |
Answer Posted By |
|
Question Submitted By :: Hehe |
| This Interview Question Asked @ DELL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | It is page size. almost 64k in linux OS.
After which we have to use realloc to get more memory.
In case, there is more memory available in dynamic memory
space, then realloc will give the pointer else NULL.  |
| Vrushali |
| |
| |
| Question |
Total of how many functions are available in c? |
Rank |
Answer Posted By |
|
Question Submitted By :: Rajasekhar |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | good morining to all ,
C is full of functions.... that point am making it clear.. we cant even get any input or output without using functions...
printf();, scanf(); , getc();, are some of the well known fuctions...
i can say C has some 200 to 300 function approx. i dont know...
thank u  |
| Vignesh1988i |
| |
| |
| Answer | hello
not coorect but aprocsimet 200-300 fuctuion in c  |
| Devanshu |
| |
| |
| Question |
I use turbo C which allocates 2 bytes for integers and 4
bytes for long. I tried to declare array of size 500000 of
long type using the following code...
long *arr;
arr=(long *)(malloc)(500000 * sizeof(long));
It gives a warning that "Conversion may lose significant
digits in function main"...
And the resulting array size was very less around 8400 as
compared to 500000. Any suggestions will be welcomed....
|
Rank |
Answer Posted By |
|
Question Submitted By :: Anshu Ranjan |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | good morning to you.....
here what i suggest is that , at the time of dynamic memory allocation the memory would not been in the position to allocate that much of huge memory at a single instance...... UR MEMORY WILL BE INCAPABLE IF U TRY TO ALLOCATE A HUGE AMOUNT LIKE ABOVE FOR UR USE.......
u try this.... you declare an array size of 200 or 300... this will give a warning that MEMORY FULL........ the one of the disadvantages in C is that we cant balance a very large amount of data's which are outside the range .... so only we will go for DATA BASE.......
hope this helps u for getting some ideas.......
thank u  |
| Vignesh1988i |
| |
| |
| Answer | I want to make a point here...I am not sure whether there is a limit to amount of memory that you can allocate using malloc...
I used this code in a program and it ran perfectly fine...
--------------
char **a;
int **val;
a =(char **) malloc ( 1000 * sizeof *a );
for ( i = 0; i < 1000; i++ )
a[i] =(char *) malloc ( 1000 * sizeof *a[i] );
val =(int **) malloc ( 1000 * sizeof *val );
for ( i = 0; i < 1000; i++ )
val[i] =(int *) malloc ( 1000 * sizeof *val[i] );
---------------  |
| Anshu Ranjan |
| |
| |
| Question |
Find the middle node in the linked list??
(Note:Do not use for loop, count and count/2) |
Rank |
Answer Posted By |
|
Question Submitted By :: Bharath Subash.d |
| This Interview Question Asked @ Subex |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Keep two pointers,
1. fast pointer moves two nodes at a time
2. slow pointer moves one node at a time
keep moving both the pointers, once the fast pointer reaches
the end node, your slow pointer would be at middle of the list.  |
| Kstarmind |
| |
| |
| Answer | U mean without any looping statements r just for loop?????
It can be done in a single traversal using Hare n turtle
method as said above using a for or while loop.....
Without using looping statements d list can't be traversed..
Plz make the question clear.....  |
| Vadivel |
| |
| |
| Question |
How to convert a binary number to Hexa decimal number??
(Note:Do not convert it into binary and to Hexadecimal) |
Rank |
Answer Posted By |
|
Question Submitted By :: Bharath Subash.d |
| This Interview Question Asked @ Subex |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | let us take a binary number.. say :
0000000110101110 (16 bit number)
we already know it's the consersion to HEXA DECIMAL equivalent.... so split the numbers into 4 bits each... like,
0000 0001 1010 1110 (16 bit number)
and for converting directly there is a conversion called 8421 code...
8421 | 8421 | 8421 | 8421
0000 | 0001 | 1010 | 1110
now in the first pass it is zero (from left to right) , second it is 1 , in third it is 10 (A in hexa.) , in fourth it is 14 (E in hexa.)
thus the final representation for the above binary is : 1AE
thank u  |
| Vignesh1988i |
| |
| |
|
| |
|
Back to Questions Page |