csharp practice bits

csharp practice bits

University

20 Qs

quiz-placeholder

Similar activities

Text me!

Text me!

University

20 Qs

E-Commerce

E-Commerce

University - Professional Development

16 Qs

DCN5511: Chapter 5 - 7

DCN5511: Chapter 5 - 7

University

15 Qs

Revision : Chapter 1

Revision : Chapter 1

University

19 Qs

Control Structures  C#

Control Structures C#

University

20 Qs

YAY! Fridate with ComSSA (Network 101)

YAY! Fridate with ComSSA (Network 101)

University

20 Qs

Programación Básica Prácticas Tema 2

Programación Básica Prácticas Tema 2

University

19 Qs

HTML -znaczniki 1

HTML -znaczniki 1

7th Grade - University

15 Qs

csharp practice bits

csharp practice bits

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

kalyani boyina

Used 5+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 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;

  4. for (i = 0; ; )

  5. {

  6. Console.WriteLine("hello");

  7. }

  8. Console.ReadLine();

  9. }

No output


hello

hello printed infinite times

Code will give error as expression syntax

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 f;

  4. for (f = 0.1f; f <= 0.5; f += 1)

  5. Console.WriteLine( ++f );

  6. Console.ReadLine();

  7. }

1.1

0.1

0.1 0.2 0.3 0.4 0.5

None of the mentioned

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, X;

  4. for (I = 1; I <= (9 % 2 + I); I++)

  5. {

  6. X = (I 3 + I 2) / I;

  7. Console.WriteLine(X);

  8. }

  9. Console.ReadLine();

  10. }

Output of code is 5 10

Output is 5 5 5 5

Print 5 infinite times

None of the mentioned

4.

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, J = 0;

  4. for (I = 1; I < 10; ) ;

  5. {

  6. J = J + I;

  7. I += 2;

  8. }

  9. Console.WriteLine("Sum of first 10 even numbers is:"+J);

  10. Console.ReadLine();

  11. }

1 2 3 4 5 6 7 8 9

25

1

Run time error

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. int i = 5;

  4. for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ;

  5. Console.ReadLine();

  6. }

4 3 2 1

3 2 1

5 4 3 2 1

2 1

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. int i, s = 0;

  4. for (i = 1; i <= 10; s = s + i, i++);

  5. {

  6. Console.WriteLine(s);

  7. }

  8. Console.ReadLine();

  9. }

Code report error

Code runs in infinite loop condition

Code gives output as 0 1 3 6 10 15 21 28 36 45

Code give output as 55

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which statement is correct among the mentioned statements?
i. The for loop works faster than a while loop
ii. for( ; ; )implements an infinite loop

Only i is correct

Only ii is correct

Both i and ii are correct

Both i and ii are incorrect

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