Search Header Logo

csharp

Authored by kalyani boyina

Computers

University

Used 4+ times

csharp
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 will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int i = 1, j = 2, k = 3;

  4. do

  5. {

  6. Console.WriteLine((Convert.ToBoolean(Convert.ToInt32(i++)))

  7. && (Convert.ToBoolean(Convert.ToInt32(++j))));

  8. }while (i <= 3);

  9. Console.ReadLine();

  10. }

a) 0 0 0


b) True True True

c) 1 1 1

d) False False False

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. float i = 1.0f, j = 0.05f;

  4. do

  5. {

  6. Console.WriteLine(i++ - ++j);

  7. }while (i < 2.0f && j <= 2.0f);

  8. Console.ReadLine();

  9. }

a) 0.05


b) -0.05

c) 0.95

d) -0.04999995

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. int i = 1, j = 5;

  4. do

  5. {

  6. Console.WriteLine(i = i++ * j);

  7. }while (i <= 10);

  8. Console.ReadLine();

  9. }

a) 5 10 15 20 25 30 35 40 45 50


b) 5 25

c) 5 11 16 21 26 31 36 41 46 51

d) 5 30

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop?

  1. static void Main(string[] args)

  2. {

  3. int i = 1234 ,j = 0;

  4. /*ADD CODE HERE */

  5. Console.WriteLine(j);

  6. }

a)

do { j = j + (i % 10); }while ((i = i / 10)!= 0);

b)

do { j = j + (i % 10); }while ((i / 10)!= 0);

c)

do { j = j + (i % 10); }while ((i % 10)!= 0);

d)

do { j = j + (i % 10); }while ((i/10 == 0)!= 0);

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. long x;

  4. x = Convert.ToInt32(Console.ReadLine());

  5. do

  6. {

  7. Console.WriteLine(x % 10);

  8. }while ((x = x / 10) != 0);

  9. Console.ReadLine();

  10. }

  11. enter x = 1234.

a) number of digits present in x


b) prints ‘1’

c) prints reverse of x

d) prints sum of digits of ‘x’

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following C# code?

  1. static void Main(string[] args)

  2. {

  3. long x;

  4. x = Convert.ToInt32(Console.ReadLine());

  5. do

  6. {

  7. Console.WriteLine(x % 10);

  8. }while ((x = x / 10) != 0);

  9. Console.ReadLine();

  10. }

  11. enter x = 1234.

a) number of digits present in x


b) prints ‘1’

c) prints reverse of x

d) prints sum of digits of ‘x’

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for do while loop?

a)

do; { statement; }while (condition);

b)

do(condition) { statement; }while;

c)

do { statement; }while (condition)

d)

do { statement; }while (condition);

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 Computers