My Report

C# Programming Mock Test 3


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

Question 1 of 10

1. Which statement is correct about following C# code?

int[, ]a={{5, 4, 3},{9, 2, 6}};

Question 1 of 10

Question 2 of 10

2. Which is the correct way of defining and initializing an array of 3 integers?

Question 2 of 10

Question 3 of 10

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

 
 static void Main(string[] args)
 {
     string s1 = "Hello I Love Csharp ";
     Console.WriteLine(Convert.ToChar( (s1.IndexOf('I') - s1.IndexOf('l')) * s1.IndexOf('p'));
     Console.ReadLine();
 }

Question 3 of 10

Question 4 of 10

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

 
    static void Main(string[] args)
    {
        int x = 4 ,b = 2;
        x -= b/= x * b;
        Console.WriteLine(x + " " + b);
        Console.ReadLine();
    }
 

Question 4 of 10

Question 5 of 10

5. The method called by clients of a class to explicitly release any resources like network, connection, open files etc. When the object is no longer required?

Question 5 of 10

Question 6 of 10

6. Correct way to convert a string to uppercase using string class method()?

Question 6 of 10

Question 7 of 10

7. Which among the following is the correct statement: Constructors are used to?

Question 7 of 10

Question 8 of 10

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

  
static void Main(string[] args)
{
    Mul();
    m();
    Console.ReadLine();
}
static void Mul()
{
    Console.WriteLine("4");
}
static void m()
{
    Console.WriteLine("3");
    Mul();
}

Question 8 of 10

Question 9 of 10

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

static void Main(string[] args)
{
    String c = "Hello";
    String a ;
    a = c.Replace('l', 'w');
    Console.WriteLine(a);
    Console.ReadLine();
}

Question 9 of 10

Question 10 of 10

10. Can the method add() be overloaded in the following ways in C#?

public int add()  {    }
public float add(){    }

Question 10 of 10


 

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.