Question
#include <stdio.h>
int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
a.
The compiler will flag an error
b.
Program will compile and print the output 5
c.
Program will compile and print the ASCII value of 5
d.
Program will compile and print FAIL for 5 times
Posted under C Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Comment on the output of this C code? #include <stdio.h> int main() { int a[5] = {1, 2, 3, 4, 5}; int i; for (i = 0; i < 5; i++)...
Similar Questions
Discover Related MCQs
Q. Which of the datatypes have size that is variable?
View solution
Q. For the following code snippet:
char *str = “compscibits.com\0” “training classes”;
The character pointer str holds reference to string:
View solution
Q. enum types are processed by
View solution
Q. Which is false?
View solution
Q. Which of the following declaration is not supported by C?
View solution
Q. Which of the following declaration is illegal?
View solution
Q. Which keyword is used to prevent any changes in the variable within a C program?
View solution
Q. Which of the following is not a pointer declaration?
View solution
Q. Which is false ?
View solution
Q. A variable declared in a function can be used in main
View solution
Q. The name of the variable used in one function cannot be used in another function
View solution
Q. The precedence of arithmetic operators is (from highest to lowest)
View solution
Q. Which of the following is not an arithmetic operation?
View solution
Q. Which of the following data type will throw an error on modulus operation(%)?
View solution
Q. Which among the following are the fundamental arithmetic operators, i.e, performing the desired operation can be done using that operator only?
View solution
Q. Are logical operators sequence points?
View solution
Q. Does logical operators in C language are evaluated with short circuit?
View solution
Q. Result of a logical or relational expression in C is
View solution
Q. Which among the following is NOT a logical or relational operator?
View solution
Q. Relational operators cannot be used on:
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!