| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| what is the output of the following program?
#include<stdio.h>
void main()
{
float x=1.1;
while(x==1.1)
{
printf("\n%f",x);
x=x-0.1;
}
} | | 4 |
| dynamically allocate memory for linear array of n
integers,store some elements in it and find some of them | | 1 |
| when will be evaluated as true/
if(x==x==x)
a) x=1;
b) x=0;
c) x=-1;
d) none | HCL | 4 |
| What is structure packing ? | HP | 1 |
| 2.Given the short c program that follows
a. make a list of the memory variables in this program
b.which lines of code contain operations that change the
contents of memory? what are those operations?
Void main( void)
{
Double base;
Double height;
Double area;
Printf(“enter base and height of triangle :”);
Scanf(“%lg”, &base);
Scanf(“%lg”, &height);
Area=base*height/2.0;
Printf(“the area of the triangle is %g \n”,area);
}
| Wipro | 1 |
| What is the difference between null pointer and void pointer | CTS | 3 |
| Why data types in all programming languages have some range?
Why ritche have disigned first time likethat?Why not a
single data type can support all other types? | Excel | 1 |
| the format specified for hexa decimal is
a.%d
b.%o
c.%x
d.%u
| TCS | 4 |
| To what value are pointers initialized?
1) NULL
2) Newly allocated memory
3) No action is taken by the compiler to initialize
pointers.
| | 2 |
| difference between i++* and *++i | IBM | 3 |
| pgm to find number of words starting with capital letters
in a file(additional memory usage not allowed)(if a word
starting with capital also next letter in word is capital
cann't be counted twice) | Subex | 1 |
| Toggle nth bit in a given integer - num | Qualcomm | 2 |
| array contains zeros and ones as elements.we need to bring
zeros one side and one other side in single parse.
ex:a[]={0,0,1,0,1,1,0,0}
o/p={0,0,0,0,0,1,1,1} | Motorola | 7 |
| program to get the remainder and quotant of given two
numbers with out using % and / operators? | IBM | 8 |
| Concat two string with most overlapped substring has to
remove "abcd"+ "cdef" = "abcdef | | 5 |
| What kind of sorting is this?
SORT (k,n)
1.[Loop on I Index]
repeat thru step2 for i=1,2,........n-1
2.[For each pass,get small value]
min=i;
repeat for j=i+1 to N do
{
if K[j]<k[min]
min=j;
}
temp=K[i];K[i]=K[min];K[min]=temp;
3.[Sorted Values will be returned]
A)Bubble Sort
B)Quick Sort
C)Selection Sort
D)Merge Sort | Accenture | 3 |
| What does a run-time "null pointer assignment" error mean? | | 2 |
| What character terminates all strings composed of character
arrays?
1) 0
2) .
3) END
| | 3 |
| 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 |
| Write a C program to print 1 2 3 ... 100 without using
loops? | | 5 |
| |
| For more C Interview Questions Click Here |