81. What are strings in C#?
82. What will be the output of the following C# code snippet?
class Program
{
static void Main(string[] args)
{
double x = 2.0;
double y = 3.0;
double z = Math.Pow( x, y );
Console.WriteLine(z);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
double x = 2.0;
double y = 3.0;
double z = Math.Pow( x, y );
Console.WriteLine(z);
Console.ReadLine();
}
}
83. What is multithreaded programming?
84. Which is the correct statement about the namespaces in C#.NET?
85. What will be the output of the following C# code snippet?
class Program
{
static void Main(string[] args)
{
double x = 3.14;
int y = (int) Math.Ceiling(x);
Console.WriteLine(y);
}
}
class Program
{
static void Main(string[] args)
{
double x = 3.14;
int y = (int) Math.Ceiling(x);
Console.WriteLine(y);
}
}
86. Which method is used to abort thread prior to it's normal execution?
87. What will be the output of the following C# code snippet?
class MyClass
{
int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
public IEnumerator GetEnumerator()
{
for (int i = 0; i < 20; i++)
{
if (a[i] % 2 == 0)
yield return (int)(a[i]);
}
}
}
class Program
{
static void Main(string[] args)
{
MyClass mc = new MyClass();
foreach (int i in mc)
Console.Write(i + " ");
Console.WriteLine();
Console.ReadLine();
}
}
class MyClass
{
int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
public IEnumerator GetEnumerator()
{
for (int i = 0; i < 20; i++)
{
if (a[i] % 2 == 0)
yield return (int)(a[i]);
}
}
}
class Program
{
static void Main(string[] args)
{
MyClass mc = new MyClass();
foreach (int i in mc)
Console.Write(i + " ");
Console.WriteLine();
Console.ReadLine();
}
}
88. What will be the output of the following C# code snippet?
#define DEBUG
#define MYTEST
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
#if (DEBUG && !MYTEST)
Console.WriteLine("DEBUG is defined");
#elif (!DEBUG && MYTEST)
Console.WriteLine("MYTEST is defined");
#elif (DEBUG && MYTEST)
Console.WriteLine("DEBUG and MYTEST are defined");
#else
Console.WriteLine("DEBUG and MYTEST are not defined");
#endif
Console.ReadLine();
}
}
}
#define DEBUG
#define MYTEST
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
#if (DEBUG && !MYTEST)
Console.WriteLine("DEBUG is defined");
#elif (!DEBUG && MYTEST)
Console.WriteLine("MYTEST is defined");
#elif (DEBUG && MYTEST)
Console.WriteLine("DEBUG and MYTEST are defined");
#else
Console.WriteLine("DEBUG and MYTEST are not defined");
#endif
Console.ReadLine();
}
}
}
89. Which is the correct statement about an ArrayList collection that implements the IEnumerable interface?
90. What will be the output of the following C# code snippet?
static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
Console.WriteLine(s);
}
static void main(String args[])
{
char chars[] = {'a', 'b', 'c'};
String s = new String(chars);
Console.WriteLine(s);
}
Read More Section(Miscellaneous in C Sharp)
Each Section contains maximum 100 MCQs question on Miscellaneous in C Sharp. To get more questions visit other sections.