Welcome to Your Quiz: Aptitude Test C Programming For If Else Statements

Name Email
1. Which of the following is an invalid if-else statement?
2. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 5;
if (x < 1);
printf("Hello");
}
3. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 5;
if (true);
printf("hello");
}
4. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x >= 0)
printf("true\n");
else
printf("false\n");
}
5. What will be the output of the following C code?
#include<stdio.h> 
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}
6. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x == 0)
printf("inside if\n");
else
printf("inside else if\n");
else
printf("inside else\n");
}
7. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1;
if (a--)
printf("True");
if (a++)
printf("False");
}
8. What is output of below program?
#include<stdio.h>
int main()
{
    if(printf("C programming is "))
    {   
        printf("Easy");
    }
    else
    {
        printf("Hard");
    }
    return 0;
}
9. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
10. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x++)
printf("true\n");
else if (x == 1)
printf("false\n");
}
11. What will be the output of the following C code?
#include <stdio.h>
int x;
void main()
{
if (x)
printf("hi");
else
printf("how are u");
}
12. What will be the output of the following C code?
#include<stdio.h> 
void main()
{
int x = 0;
if (x == 0)
printf("hi");
else
printf("how are u");
printf("hello");
}
13. What will be the output of the following C code?
#include <stdio.h>
int main()
{
if (printf("%d", printf(")))
printf("We are Happy");
else if (printf("1"))
printf("We are Sad");
}
14. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 0;
if (x == 0)
printf("true, ");
else if (x = 10)
printf("false, ");
printf("%d\n", x);
}
15. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a = 1;
if (a)
printf("All is Well ");
printf("I am Well\n");
else
printf("I am not a River\n");
}

Thank You for Submitting your response for Quiz

Aptitude Test C Programming For If Else Statements

Please click on View Result Button to see the Result.



(Visited 205 times, 1 visits today)