C
#include <stdio.h>
int main ()
{
int i = 1024 ;
for (; i ; i >>= 1 )
printf ( "GeeksQuiz" );
return 0 ;
}
How many times will GeeksQuiz be printed in the above program?
The program will show compile-time error
C
#include <stdio.h>
#define PRINT(i, limit) do \\
{ \\
if (i++ < limit) \\
{ \\
printf("GeeksQuiz\\n"); \\
continue; \\
} \\
}while(0);
int main ()
{
int i = 0 ;
PRINT ( i , 3 );
return 0 ;
}
How many times GeeksQuiz is printed in the above program ?
What is the output of the below program?
C
#include <stdio.h>
int main () {
int i = 2 ;
switch ( i ) {
case 0 :
printf ( "Geeks" );
break ;
case 1 :
printf ( "Quiz" );
break ;
default :
printf ( "GeeksQuiz" );
}
return 0 ;
}
C
#include <stdio.h>
int main () {
int i = 3 ;
switch ( i ) {
case 1 :
printf ( "Geeks" );
break ;
case 1 + 2 :
printf ( "Quiz" );
break ;
default :
printf ( "GeeksQuiz" );
}
return 0 ;
}
What is the output of the above program?
Predict the output of the below program:
C
#include <stdio.h>
#define EVEN 0
#define ODD 1
int main () {
int i = 3 ;
switch ( i % 2 ) {
case EVEN :
printf ( "Even" );
break ;
case ODD :
printf ( "Odd" );
break ;
default :
printf ( "Default" );
}
return 0 ;
}
C
#include <stdio.h>
int main () {
int i ;
if ( printf ( "0" ))
i = 3 ;
else
i = 5 ;
printf ( "%d" , i );
return 0 ;
}
Predict the output of above program?
C
#include <stdio.h>
int i ;
int main () {
if ( i ) {
// Do nothing
} else {
printf ( "Else" );
}
return 0 ;
}
What is correct about the above program?
It is unpredictable as i is not initialized.
C
#include <stdio.h>
int main ()
{
int n ;
for ( n = 9 ; n != 0 ; n -- )
printf ( "n = %d" , n -- );
return 0 ;
}
What is the output?
Output?
C
#include <stdio.h>
int main ()
{
int c = 5 , no = 10 ;
do {
no /= c ;
} while ( c -- );
printf ( "%d \\ n" , no );
return 0 ;
}
C
# include <stdio.h>
int main ()
{
int i = 0 ;
for ( i = 0 ; i < 20 ; i ++ )
{
switch ( i )
{
case 0 :
i += 5 ;
case 1 :
i += 2 ;
case 5 :
i += 5 ;
default :
i += 4 ;
break ;
}
printf ( "%d " , i );
}
return 0 ;
}
Ready to go from coding beginner to development pro? Our DSA to Development Coding Guide has everything you need to crush coding interviews and ace real-world projects! Limited spots available!
There are 45 questions to complete.
Take a part in the ongoing discussion View All Discussion