| Other C Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| f(*p)
{
p=(char *)malloc(6);
p="hello";
return;
}
main()
{
char *p="bye";
f(p);
printf("%s",p);
}
what is the o/p?
| Hughes | 4 |
| program to find the second largest word in a paragraph
amongst all words that repeat more thn twice | iGate | 3 |
| Program to find the absolute value of given integer using
Conditional Operators | N-Tech | 2 |
| main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
Find the Outputs? | CitiGroup | 7 |
| What is the result
main()
{
char c=-64;
int i=-32
unsigned int u =-16;
if(c>i){
printf("pass1,");
if(c<u)
printf("pass2");
else
printf("Fail2");}
else
printf("Fail1);
if(i<u)
printf("pass2");
else
printf("Fail2")
}
a)Pass1,Pass2
b)Pass1,Fail2
c)Fail1,Pass2
d)Fail1,Fail2
e)none
| IBM | 7 |
| What will be result of the following program?
void myalloc(char *x, int n)
{
x= (char *)malloc(n*sizeof(char));
memset(x,\0,n*sizeof(char));
}
main()
{
char *g="String";
myalloc(g,20);
strcpy(g,"Oldstring");
printf("The string is %s",g);
}
a) The string is : String
b) Run time error/Core dump
c) The string is : Oldstring
d) Syntax error during compilation
e) None of these
| IBM | 3 |
| int a=2,b=3,c=4;
printf("a=%d,b=%d\n",a,b,c);
what is the o/p? | Verifone | 6 |
| 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....
| | 2 |
| Write a program to compare two strings without using the
strcmp() function | Accenture | 14 |
| give one ip, find out which contry | Google | 4 |
| Tell us the difference between these two :
#include"stdio.h"
#include<stdio.h>
define in detial. | | 4 |
| size maximum allocated by calloc() | DELL | 1 |
| What's wrong with "char *p = malloc(10);" ? | | 4 |
| main()
{int a=200*200/100;
printf("%d",a);
} | TCS | 7 |
| whether itis a structured language? | Microsoft | 1 |
| write a program to display the array elements in reverse
order in c language | | 6 |
| what is differnence b/w macro & functions | | 1 |
| Explain the differences between public, protected, private
and internal. | | 1 |
| suppose we use switch statement and we intilize years name
using enum statement like(jan,feb,mar,------dec) we take
integer value as an input .question is that the month which
we analyz is from 0 to 11 bt if i enter 12 than how he
again starts from begning and print jan | | 1 |
| write a own function for strstr | LG-Soft | 1 |
| |
| For more C Interview Questions Click Here |