
Mastering C# Conditional Statements
Quiz
•
Professional Development
•
Professional Development
•
Practice Problem
•
Medium
Rodrigo Calapan
Used 1+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of an if statement in C#?
To create loops in C#
The purpose of an if statement in C# is to control the execution of code based on a condition.
To declare variables in C#
To define classes in C#
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you write an if-else statement in C#?
if (condition) { // code } else { // code }
if condition { // code } else // code
if (condition) { // code } else if { // code }
if (condition) // code else { // code }
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a nested if statement? Provide an example.
if (x < 10) { console.log('x is less than 10'); }
Example: if (x > 10) { if (y < 5) { console.log('x is greater than 10 and y is less than 5'); } }
if (y > 5) { if (x == 10) { console.log('y is greater than 5 and x is equal to 10'); } }
if (x == 5) { console.log('x is equal to 5'); }
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the switch statement and when to use it.
The switch statement is a type of conditional that only works with strings.
The switch statement can only handle boolean values.
The switch statement is used to execute different parts of code based on the value of a variable, particularly when there are multiple possible values.
The switch statement is used for looping through arrays.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code: if (x > 10) { Console.WriteLine("Greater"); }?
Greater
Not Greater
Equal
Less
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you use multiple conditions in an if statement?
You can use logical operators like '&&' for 'and' and '||' for 'or' to combine multiple conditions.
You can use mathematical operators like '+' and '-' to combine conditions.
You must use a switch statement instead of if.
You can only use one condition in an if statement.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between == and = in C#?
The difference is that '=' assigns a value, and '==' checks for equality.
Both '=' and '==' are used for assignment in C#.
'==' is used to declare variables, while '=' is for comparison.
'=' checks for equality, and '==' assigns a value.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Recursia
Quiz
•
Professional Development
15 questions
Sports Analytics
Quiz
•
Professional Development
10 questions
Business Writing 4
Quiz
•
Professional Development
20 questions
Accent
Quiz
•
Professional Development
11 questions
Cycle 1 - Session 8 Quiz - Conditional Algorithms
Quiz
•
Professional Development
15 questions
Audit Planning
Quiz
•
Professional Development
10 questions
New Hire Orientation
Quiz
•
Professional Development
10 questions
Model dan Media Pembelajaran Inovatif
Quiz
•
University - Professi...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
