Search Header Logo

C# Programming Essentials

Authored by Rodrigo Calapan

Professional Development

Professional Development

Used 1+ times

C# Programming Essentials
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default value of an int in C#?

-1

1

null

0

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which data type is used to store a single character in C#?

string

float

int

char

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What keyword is used to define a conditional statement in C#?

else

when

if

switch

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you write an if statement in C#?

if (condition) { // code to execute }

if condition { // code to execute }

if (condition) // code to execute

if { condition } // code to execute

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the else clause in an if-else statement?

To create a loop that repeats the if condition.

To execute a block of code when the if condition is true.

To execute a block of code when the if condition is false.

To define a function that runs before the if statement.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can you nest if statements in C#? Give an example.

if (condition1) { if (condition2) { // Code to execute if condition1 is false } }

Example: if (condition1) { if (condition2) { // Code to execute if both condition1 and condition2 are true } }

if (condition1) { // Code to execute }

if (condition1 && condition2) { // Code to execute if either condition is true }

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for a switch statement in C#?

switch (variable) { case value1: // code block; break; case value2: // code block; break; default: // code block; }

switch: variable { case value1: // code block; }

switch (variable) case value1: // code block; break;

switch variable { case value1: // code block; }

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Professional Development