Search Header Logo

C#.net test 1

Authored by SUNITA YADAV

Computers

University

Used 14+ times

C#.net test 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

  1. static void Main(string[] args)

  2. {

  3. int a, b, c, x;

  4. a = 80;

  5. b = 15;

  6. c = 2;

  7. x = a - b / (3 c) ( a + c);

  8. Console.WriteLine(x);

  9. Console.ReadLine();

  10. }

78

-84

80

98

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

m = 5; int y;

y = m++;

y = ++m;

y = 5, m = 6; y = 7, m = 7

y = 6, m = 6; y = 7, m = 6

y = 5, m = 6 ; y = 5, m = 5

y = 5, m = 6; y = 7, m = 8

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

  1. bool a = true;

  2. bool b = false;

  3. a |= b;

  4. Console.WriteLine(a);

  5. Console.ReadLine();

0

1

True

False

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

  1. static void Main(string[] args)

  2. {

  3. int a = 5, b = 10;

  4. if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b))) {

  5. Console.WriteLine(a + "\n" + b);

  6. }

  7. else

  8. Console.WriteLine(" C# ");

  9. }

6 11

6 16

6 12

6 10

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

  1. static void Main(string[] args)

  2. {

  3. char ch = 'p';

  4. switch (ch)

  5. {

  6. case 'p':

  7. Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch));

  8. break;

  9. default:

  10. Console.WriteLine("default");

  11. break;

  12. }

  13. Console.WriteLine("main");

  14. }

coco main

coco 112

coco 112 main

compile time error

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

  1. static void Main(string[] args)

  2. {

  3. int i = 0;

  4. if (i == 0)

  5. {

  6. goto label;

  7. }

  8. label: Console.WriteLine("HI...");

  9. Console.ReadLine();

  10. }

Hi…infinite times

Code runs prints nothing

Hi Hi

Hi…

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is used to define the member of a class externally?

:

::

#

none of the mentioned

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?