csharp practice bits

csharp practice bits

University

20 Qs

quiz-placeholder

Similar activities

OCA Unit 1

OCA Unit 1

11th Grade - Professional Development

23 Qs

Java 2D Array

Java 2D Array

University

20 Qs

Java 2D Arrays

Java 2D Arrays

University

20 Qs

CSC134: Introduction to computers

CSC134: Introduction to computers

University

15 Qs

conceptos - Js

conceptos - Js

University

19 Qs

COSC_1436_ MOD-01 & MOD-02 Quiz

COSC_1436_ MOD-01 & MOD-02 Quiz

University

16 Qs

Programming Java

Programming Java

University

20 Qs

Java Quiz - 1

Java Quiz - 1

University

15 Qs

csharp practice bits

csharp practice bits

Assessment

Quiz

Computers

University

Hard

Created by

kalyani boyina

Used 5+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?