9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855

### C# QUESTIONS : PART 6

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

true

false

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

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

ToString
ToSingle
ToChar
ToDateTime

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

true

false

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;
}
}
}
}

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

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

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

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

imports
using
exports
None of the above.

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);
}

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;
}

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

Len

Length

Arraylen

arraylength

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

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

Copy

Copyall