C# Quiz

by | Nov 19, 2022 | Assessment, Interview

Home » Interview » Assessment » C# Quiz

Welcome to our C# quiz! C# is a modern, powerful programming language that’s widely used for developing desktop applications, video games, and web applications. Whether you’re just starting to learn C# or you’re an experienced developer, this quiz will challenge your knowledge of the language and help you identify areas where you might need to improve. With a mix of multiple choice and coding questions, you’ll be tested on topics like syntax, data types, object-oriented programming, and more. So, let’s get started and see how well you know C#!

8

C# Quiz

Test your knowledge of the C# programming language with our interactive C# quiz! Challenge yourself with a variety of multiple choice and coding questions on topics ranging from syntax to object-oriented programming.

1 / 30

What does enum refer to in the following code?

2 / 30

To achieve security and hide important details, we can use ________ classes & methods.

3 / 30

If you don't want other classes to inherit from a class, use the _________ keyword.

4 / 30

What is the function of WriteAllText() in C#?

5 / 30

What will be the output of the following program? using System;
namespace MyApp
{
class Function
{
static void Main(string[] args)
{
int myInt = 11;
double myDouble = myInt;

Console.WriteLine(myInt);
Console.WriteLine(myDouble);
}
}
}

6 / 30

The following code is an example of? using System;

namespace MyApp
{
class Planets
{
private string model = "Jupiter";

static void Main(string[] args)
{
Planets myObj = new Planets();
Console.WriteLine(myObj.model);
}
}
}

7 / 30

What will be the output of the following code? using System;
using System.Linq;

namespace MyApp
{
class Program
{
static void Main(string[] args)
{
int[] myNum = {13, 4, 21, 34, 10};
Console.WriteLine(myNum.Max());

Console.WriteLine(myNum.Sum());
}
}
}

8 / 30

Which of the following code will print output of 7?

9 / 30

OOP'S work on the basic principle of

10 / 30

When a parameter is passed to a method, it is called _______.

11 / 30

Which is the predefined method?

12 / 30

What is a method in C#?

13 / 30

What is the use of system.linq namespace?

14 / 30

What will be the output of the following code? using System;

namespace MyApp
{
class Program
{
static void Myelement(string games = "Tennis")
{
Console.WriteLine(games);
}

static void Main(string[] args)
{
Myelement("Football");
Myelement("Basketball");
Myelement();
Myelement("Cricket");
}
}
}

15 / 30

What will be the output of the following code? using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
string[] fruits = {"apple" , "mango" , "grapes"};
foreach (string i in fruits){ Console.WriteLine(i); }
}
} }

16 / 30

What is the output of the following code?

using System;

namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
string p = "10";
string q = "20";
string r = p + q;
Console.WriteLine(r);
}
}
}

17 / 30

Which of the following code will print output "Table tennis"?

18 / 30

What will be output of the following code? using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
string txt = "You can use pen \ pencil in your homework.";
Console.WriteLine(txt); }
}
}

19 / 30

Which is the necessary sign while using the string interpolation method in C#?

20 / 30

What will be the output of the following code? using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Math.Abs(-5.4)); }
}
}

21 / 30

Which of the following code will print output as True?

22 / 30

Which of the following code will print an output 23?

23 / 30

Console.ReadLine() is used in C# to

24 / 30

________ is the property of C# in which we can assign a value of one data type to another type.

25 / 30

What will be the output the of following code? using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
int p, q, r;
p = q = r = 20; Console.Write(p + q + r); }
}
}

26 / 30

What is the output of the following code?

using System;
namespace MyApp
{
class Program
{
static void Main(string[] args)
{
Console.Write("My name is Peter");
Console.Write("I am genius."); }
}
}

27 / 30

C# is a case-sensitive language.

28 / 30

Console is a class of ________ and has a method ________.

29 / 30

What is "using system" in the below code?

using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

30 / 30

C# is a programming language that is created by ________ & runs on ________ framework.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author