Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C# QUESTIONS : PART 6

Variables are initialized (assigned a value) with an equal sign followed by a constant expression. This statement is?

true

false

SHOW ANSWER

What is the purpose of an operator?

used to  perform only logical operations

used to perform  only mathematical operations

used to peform specific mathematical or logical opearations

SHOW ANSWER

Which of the following converts a type (integer or string type) to date-time structures in C#?

ToString
ToSingle
ToChar
ToDateTime
SHOW ANSWER

If statement is always used with a condition.This statement is?

true

false

SHOW ANSWER

What Will Be The Output Of The Following Code Snippet:

       using System;
namespace ProgrammingExercise
{
class FindOutput
    {
     static void Main(string[] args)

     {
     int i;
     int div = 8, num = 32;
     for (i = 0; i <= 10; i++)
     {
         if ((num / div * 3)== 6)
         {
             Console.WriteLine( i + " ");
             continue;
         }
         else if (i != 5)
             Console.Write(i + " ");
         else
             break;
    }
    Console.ReadLine();
    }
   }
}
 

1 2 3 4 5 6 7 8 9 10

 0 1 2 3 4 5 6 7 8 9 10

0 1 2 3 4 5

0 1 2 3 4

SHOW ANSWER

What Will Be The Output Of The Following Code Snippet:

 using System;
namespace ProgrammingExercise
{
class FindOutput
    {
     static void Main(string[] args)
     {
      int a, b;
      for (a = 2; a >= 0; a--)
      {
          for (b = 0; b <= 2; b++)
          {
              if (a == b)
              {
                  Console.WriteLine("1");
              }
              else
              {
                  Console.WriteLine("0");
              }
         }
         Console.WriteLine("\n");
       }
     }
   }

}
 

1 0 0
 0 1 0
 0 0 1

0 1 0
1 0 0
 0 0 1

0 0 1
0 1 0
1 0 0

1 0 0
 0 0 1
 0 1 0

SHOW ANSWER

What Will Be The Output Of The Following Code Snippet:
using System;
namespace ProgrammingExercise
{
class FindOutput
    {
     static void Main(string[] args)
     {
     int num= 1234, r;
     while (num > 0)
      {
          r = num % 10;
          num = num / 10;
          Console.WriteLine(+r);
      }
      
      }
    }
}

1 2 3 4

4 3 2 1

2 3 4 1

3 2 4 1

SHOW ANSWER

Which of the following keyword is used for including the namespaces in the program in C#?

imports
using
exports
None of the above.

SHOW ANSWER

Select the correct ‘if statement’ to be filled in the given set of code :
 static void Main(string[] args)
 {
     int []num = {50, 65, 56, 88, 43, 52};
     int even = 0, odd = 0;
     for (int i = 0 ;i < num.Length ;i++)
     {
          /*___________________________*/
     }   
     Console.WriteLine("Even Numbers:" +even);
     Console.WriteLine("Odd Numbers:" +odd);
     Console.ReadLine();
 }
 

if ((num % 2) == 0)
   {
       even += 1;
   }
   else
   {
       odd += 1;
   }

if((num * i) == 0)
   {
       even += 1;
   }
   else
   {
       odd += 1;
   }

if(num[i] % 2 == 0)
    {
        even += 1;
    }
    else
    {
        odd += 1;
    }

if(num[i] % 2 = 0)
    {
        even += 1;
    }
    else
    {
        odd += 1;
    }

SHOW ANSWER

Which array property is used to return the length of array?

Len

 Length

Arraylen

arraylength

SHOW ANSWER

Which array property is used to check whether the array is read only or not?

IsReadOnly

ReadOnly

Read

SHOW ANSWER

Which array function is used to copy array elements to another array?

Copy

Copyall

Readall

SHOW ANSWER

What is the use of clear() function in array?

Clear an array by removing all the items

 To clear specified items from an  array

To clear 5 elements from an array

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in