C Programming Multiple Choice Question - Array And String
31. What is the output of this program?
#include <stdio.h>
void main(){
char c[] = "GATE2011";
char *p =c;
printf("%s", p + p[3] - p[1]);
}
View Answer
32. What is the output of this program?
#include <stdio.h>
#include<string.h>
void main()
{
char s1[20] = "Hello", s2[10] = " World";
printf("%s", strcpy(s2, strcat(s1, s2)));
}
View Answer
33. How many times the loop will execute ?
#include <stdio.h>
int main()
{
char str[10] = "98765", *p;
p = str + 1;
*p = '0' ;
printf ("%s", str);
}
View Answer
34. What is the output of this program?
#include <stdio.h>
void main()
{
char s[] = "Letsfind course";
printf("%s", str);
}
View Answer
35. What is the output of this program?
#include
View Answer
36. What is the output of the given code ?
#include <stdio.h>
int main()
{
int i;
char str[] = "";
if(printf("%s", str))
printf("Empty String");
else
printf("String is not empty");
return 0;
}
View Answer
37. What is the output of this program?
#include <stdio.h>
int main()
{
char str = "Hello";
printf("%s", str);
return 0;
}
View Answer
38. What is the output of this program?
#include <stdio.h>
int main()
{
char s1[] = "Hello";
char s2[] = "Hello";
if(s1 == s2)
printf("Same");
else
printf("Not Same");
return 0;
}
View Answer
39. What will be the output of the program ?
#include <stdio.h>
int main(void)
{
char p;
char buf[10]={1,2,3,4,5,6,9,8};
p=(buf+1)[5];
printf("%d",p);
return 0;
}
View Answer
40. What will be the output of the program ?
#include <stdio.h>
int main()
{
int a[5]={5,1,15,20,25};
int i,j,m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
View Answer
Also check :