My Report

C# Basic Online Test – 1


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

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

static void Main(string[] args)
{
    String name = "Dr.Gupta";
    Console.WriteLine("Good Morning" + name);
}

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

 static void Main(string[] args)
 {
     const int a = 5;
     const int b = 6;
     for (int i = 1; i <= 5; i++)
     {
         a = a * i;
         b = b * i;
     }
     Console.WriteLine(a);
     Console.WriteLine(b);
     Console.ReadLine();
 }
 

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

 static void Main(string[] args)
 {
     int a = 5;
     int b = 10;
     int c;
     Console.WriteLine(c = a-- - ++b);
     Console.WriteLine(b);
     Console.ReadLine();
 }

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

  int a,b;
  a = (b = 10) + 5;

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

 static void Main(string[] args)
 {
     int a = 5;
     int b = 10;
     int c;
     Console.WriteLine(c = ++ a + b ++);
     Console.WriteLine(b);
     Console.ReadLine();
 }

6. DIFFERENCE BETWEEN KEYWORDS 'VAR' AND 'DYNAMIC'?

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

 static void Main(string[] args)
 {
     string Name = "He is playing in a ground.";
     char[] characters = Name.ToCharArray();
     StringBuilder sb = new StringBuilder();
     for (int i = Name.Length - 1; i >= 0; --i)
     {
         sb.Append(characters[i]);
     }
     Console.Write(sb.ToString());
     Console.ReadLine(); 
 }

8. The following C# codes are?

 1. Myclass class;
    Myclass class2 = null;
 
 2. int i;
    int j = 0;
 

9. Storage location used by computer memory to store data for usage by an application is?

10. What will be the output of the following C# code conversion?

 static void Main(string[] args)
 {
     char a = 'A';
     string b = "a";
     Console.WriteLine(Convert.ToInt32(a));
     Console.WriteLine(Convert.ToInt32(Convert.ToChar(b)));
     Console.ReadLine();
 }
 

 

Start practicing “1000 MCQs on C#”, and once you are ready, you can take tests on all topics by attempting our “C# Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.