Search Header Logo

C# Programming Challenge

Authored by hakar sevoo

English

10th Grade

Used 1+ times

C# Programming Challenge
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? int x = 10; if (x > 5) { Console.WriteLine("Greater"); } else { Console.WriteLine("Smaller"); }

None

Greater

Lesser

Equal

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you use an if statement to check if a number is even or odd?

Use 'if (number % 2 === 0) { // even } else { // odd }'

Use 'if (number > 0) { // even } else { // odd }'

Use 'if (number / 2 == 0) { // even } else { // odd }'

Use 'if (number % 2 != 1) { // even } else { // odd }'

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a for loop that sums the numbers from 1 to 100.

for (i = 1; i <= 100; i++) { sum = sum + i; }

sum = 0; for (i = 1; i <= 100; i++) { sum += i; }

sum = 0; while (i <= 100) { sum += i; i++; }

sum = 0; for (i = 1; i < 100; i++) { sum += i; }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? for (int i = 0; i < 5; i++) { if (i == 2) { continue; } Console.WriteLine(i); }

-1

5

0 1 3 4

2

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Write a for loop that counts down from 10 to 1.

for (let i = 0; i < 10; i++) { console.log(i); }

for (let i = 10; i > 0; i--) { console.log(i); }

for (let i = 10; i >= 1; i--) { console.log(i); }

for (let i = 1; i <= 10; i++) { console.log(i); }

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? for (int i = 0; i < 5; i++) { if (i % 2 == 0) { Console.WriteLine(i); } }

1

0 2 4

5

3

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?