Question
QUESTION 11 What will be the output of following statements? int a[3] = {2,,1}; printf(%d,a[a[0]]); A. 0 B. 1 C. 2 D. Compile-time Error 2
QUESTION 11
-
What will be the output of following statements?
int a[3] = {2,,1};
printf("%d",a[a[0]]);
A. 0
B. 1
C. 2
D. Compile-time Error
2 points
QUESTION 12
-
What will be the output of following code?
# include
void main( )
{
printf ( " C to it that C survives" ) ;
main( ) ;
}
A. Run-time Error
B. C to it that C survives C (gets printed once)
C. C to it that C survives (gets printed indefinitely)
D. Compile-time Error
2 points
QUESTION 13
-
What will be the output of following code?
# include
int main( )
{
static int count = 5 ;
printf ( "%d ", count-- );
if ( count != 0 )
main( ) ;
}
A. 5 4 3 2 1
B. 1 2 3 4 5
C. 5
D. Indefinite loop
2 points
QUESTION 14
-
What will be the output of following code?
#include
void func( ) ;
void main( )
{
func( ) ;
func( ) ;
}
void func( )
{
auto int i = 0 ;
register int j = 0 ;
static int k = 0 ;
i++ ; j++ ; k++ ;
printf ( " %d % d %d", i, j, k ) ;
}
A. 1 1 1
1 2 2
B. 1 1 1
1 1 2
C. 1 1 1
2 2 2
D. 1 1 1
1 1 1
2 points
QUESTION 15
-
What will be the output of following code?
#include
#include
int main()
{
static char str1[] = "cester";
static char str2[20];
static char str3[] = "Wor";
int i;
i = strcmp(strcat(str3, strcpy(str2, str1)), "Worcester");
printf("%d", i);
return 0;
}
A. 1
B. -1
C. 2
D. 0
2 points
QUESTION 16
-
What will be the output of following statements?
char s[25] = "Hello";
int i=0;
char ch;
ch = s[++i];
printf("%c", ch);
ch = s[i++];
printf("%c", ch);
A. el
B. ll
C. ee
D. He
2 points
QUESTION 17
-
What will be the output of following statements?
int i;
char a[] = "";
if(printf("%s", a))
printf("The string is empty");
else
printf("The string is not empty");
A. The string is empty
B. The string is not empty
C. No output
D. 0
2 points
QUESTION 18
-
What will be the output of following statements?
char str1[] = "Hello";
char str2[] = "Hello";
if(str1 == str2)
printf("Equal");
else
printf("Unequal");
A. Equal
B. Unequal
C. Error
D. None of the above
2 points
QUESTION 19
-
What will be the output of following statement?
printf("%c", "abcdefgh"[4]);
A. Run-time Error
B. Compile-time Error
C. e
D. abcdefgh
2 points
QUESTION 20
-
What will be the output of following program?
#include
int fun(int);
int main()
{
float k=3;
fun(k=fun(fun(k)));
printf("%f", k);
return 0;
}
int fun(int i)
{
i++;
return i;
}
A. 3.000000
B. 5.000000
C. 4.000000
D. 6.000000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started