Search Header Logo

Hands-on Quiz

Authored by Asha Jyothi

Professional Development

University

Used 6+ times

Hands-on Quiz
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

5 mins • 1 pt

1.Can you complete the below C# program to find the factorial of a given number?

using System;

class Factorial {

    static void Main() {

int num = 5;

       int factorial = 1;

 

 

       Console.WriteLine("Factorial of {0} is {1}", num, factorial);

    }

}

 

for (int i = 1; i <= num; i++) { factorial *= i; }

for (int i = 1; i <= num; i++) { i = factorial * i; }

factorial = factorial * i;

for (int i = 1; i <= num; i++) { factorial = i * num; }

2.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

2. What will be the result of the following code?

int x = 5;

int y = 3;

Console.WriteLine(x + y);

A) 8

B) 15

C) 53

D) None of the above

3.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

3. How would you make this program more fun by printing "Hello, [Your Name]!" instead of "Hello, world!"?

using System;

class HelloWorld {

static void Main() {

Console.WriteLine("Hello, world!");

}

}

A) Replace "world" with your name in the WriteLine statement

B) Add a new line with Console.WriteLine ("Hello, [Your Name]!");

C) Modify the Main method to accept a string argument for the name and print it

D) None of the above

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

4.Can you complete the following C# program to determine if a given number is even or odd?

using System;

class EvenOdd {

    static void Main() {

int num = 6;

{

            Console.WriteLine("{0} is even", num);

        }

 else

       {

             Console.WriteLine("{0} is odd", num);

        }

    }

}

if (num % 2 == 0)

if (num % 10 == 0)

num % 2 == 0

if (num % 2 != 0)

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

5.What will be the value of x after the following code is executed?

int x = 5;

x ++;

A) 5
B) 6
C) 8

D) None of the above

6.

MULTIPLE SELECT QUESTION

10 mins • 2 pts

6.Complete the below C# program to Generate Fibonacci Series.

using System;

class Fibonacci {

static void Main() {

int n = 10;

int first = 0, second = 1;

Console.WriteLine("Fibonacci Series:");

for (int i = 0; i < n; i++) {

Console.Write(first + " ");

​ ​ ​ ​

second = temp; ​​

​ }​

}

}

​ ​

int temp = first + second;
first = second;
int temp = first
first = temp + second;

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?