| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| what is the diff between the printf and sprintf functions??
and what is the syntax for this two functions ?? | | 4 |
| # define prod(a,b)=a*b
main()
{
int x=2;
int y=3;
printf("%d",prod(x+2,y-10)); }
the output of the program is
a.8
b.6
c.7
d.none
| TCS | 5 |
| i want the code for printing the output as follows
4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4 | | 1 |
| write the function int countchtr(char string[],int
ch);which returns the number of timesthe character ch
appears in the string. for example the call countchtr("she
lives in Newyork",'e') would return 3. | | 4 |
| main()
{
printf("hello%d",print("QUARK test?"));
}
| | 4 |
| pgm to reverse string using arrays i.e god is love becomes
love is god)
(assumption:only space is used for seperation of words)
no addtional memory used.i.e no temporary arrays can used. | Persistent | 4 |
| Can we include one C program into another C program if yes how? | Infosys | 4 |
| 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 | 2 |
| write a program to print the all 4digits numbers & whose
squares must me even numbers? | Virtusa | 2 |
| wap to print "hello world" without using the main function. | TCS | 16 |
| write a own function for strstr | LG-Soft | 1 |
| Determine if a number is a power of 2 at O(1). | | 1 |
| Given a single Linked list with lakhs of nodes and length
unknown how do you optimally delete the nth element from the
list? | Oracle | 1 |
| what is the diference between pointer to the function and
function to the pointer? | | 2 |
| How the C program can be compiled? | HP | 7 |
| what is difference between ++(*p) and (*p)++ | Accenture | 15 |
| 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 |
| what will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p);
//Line no:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
}
//Line no 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1
| IBM | 1 |
| Given an unsigned integer, find if the number is power of 2? | | 4 |
| wat is the difference between a definition and declaration?
float y;---it looks like a declaration..but it s a
definition.how?someone explain | | 3 |
| |
| For more C Interview Questions Click Here |