Please enter your email:
1. Which is correct about if-else-if ladder?
2. int x = 0, y = 1; if (x) if (y) printf(“X and Y”); else printf(“X only”); else printf(“Neither”);
3. int marks = 40; if (marks >= 50) if (marks >= 75) printf(“Distinction”); else printf(“Pass”); else printf(“Fail”);
4. int a = 5, b = 10; if (a > b) if (a % 2 == 0) printf(“Even”); else printf(“Odd”); else printf(“Else Block”);
5. int x = 15; if (x > 0) { if (x % 2 == 0) printf(“Even Positive”); else printf(“Odd Positive”); }
6. int a = 10, b = 20; if (a < b) { if (a % 2 == 0) printf(“Small Even”); }
7. Which is valid syntax for if-else?
if-else
8. int marks = 85; if (marks >= 90) printf(“Grade A”); else if (marks >= 75) printf(“Grade B”); else printf(“Grade C”);
9. int a = 5, b = 5; if (a == b) { if (a > 0) printf(“Equal Positive”); else printf(“Equal Non-Positive”); }
10. Which statement is true about if in C?
if
Question 1 of 10
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.