adplus-dvertising

Welcome to the Arrays and Strings MCQs Page

Dive deep into the fascinating world of Arrays and Strings with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Arrays and Strings, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Arrays and Strings, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Arrays and Strings. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Arrays and Strings. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Arrays and Strings MCQs | Page 12 of 16

Explore more Topics under C# programming

Q111.
Select the correct match of parameter declaration:
static Void main(string[] args)
 {
     int a = 5;
     int b = 6;
     float c = 7.2f;
     math (ref a, ref b, ref c);
     Console.WriteLine(a + "  " + b + "  " + c);
 }
 static int math(/*add parameter decelaration   */)
 {
     a += b;
     b *= (int)c;
     c += a * b;
     return 0;
 }
Discuss
Answer: (d).ref int a, ref int b, ref float c
Discuss
Answer: (d).None of the mentioned
Q113.
The method in which large or variable number of arguments are handled is known as:
Discuss
Answer: (c).Parameter arrays
Q114.
The modifiers used to define an array of parameters or list of arguments:
Discuss
Answer: (c).param
Q115.
What will be the output for the given set of code ?
static void Main(string[] args)
 {
     object[] a = {" 1 ", 4.0f, " harsh "};
     fun(a);
     Console.ReadLine();
 }
 static void fun(params object[] b)
 {
     for (int i = 0; i < b.Length - 1; i++)
         Console.WriteLine(b[i] + " ");
 }
Discuss
Answer: (d).1 4 harsh
Q116.
What will be the output of the set of code?
static void Main(string[] args)
{
    int [] a = {1, 2, 3, 4, 5};
    fun(a);
    Console.ReadLine();
}
static void fun(params int[] b )
{
    int[] k = { 3, 4, 7, 8,'\0' };
    for (int i = 0; i < b.Length; i++)
    {
        b[i] = b[i] + k[i] ;
        Console.WriteLine( b[i] + " ");
    }
}
Discuss
Answer: (d).4, 6, 10, 12, 5
Q117.
What will be the output the of given set of code?
static void Main(string[] args)
 {
     int [] a = {1, 2, 3, 4, 5};
     fun(a);
     Console.ReadLine();
 }
 static void fun(params int[] b )
 {
     for (int i = 0; i < b.Length; i++)
     {
         b[i] = b[i] * 5 ;
         Console.WriteLine(b[i] + "");
     }
 }
Discuss
Answer: (b).5, 10, 15, 20, 25
Q118.
What will be the output of the given set of code?
static void Main(string[] args)
 {
     int[] a = { 2, 21, 34, 46, 85, 88, 90};
     fun(a);
     Console.WriteLine(a + " ");
     Console.ReadLine();
 }
 static void fun(params int [] b )
 {
     int [] c = { 1, 2, 3, 4, 5, 6, 7};
     int i ;
     for (i = 0 ;i < b.Length ;i++)
     if (b[i] % 2 == 0)
     {
         c[i] = b[i];
     }
     Console.WriteLine("even numbers are:");
     for (i = 0 ;i <= b.Length ;i++)
     {
         Console.WriteLine(c[i]);
     }
 }
Discuss
Answer: (d).2, 34, 46, 88, 90
Q119.
Select the correct declaration of the defining array of parameters:
Discuss
Answer: (d).void fun(param int[] x)
{

}
Q120.
What will be the output of the given set of code?
static void Main(string[] args)
 {
     int[] x = { 80, 82, 65, 72, 83, 67 };
     fun(x);
     Console.ReadLine();
 }
 static void fun(params int [] b )
 {
     int i;
     for (i = 5; i >=0 ; i--)
     {
         Console.WriteLine(Convert.ToChar(b[i]));
     }
 }
Discuss
Answer: (c).C S H A R P

Suggested Topics

Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!