Online C# Programming Test - C# Programming Test 3
Instruction:
- This is a FREE online test. Beware of scammers who ask for money to attend this test.
- Total number of questions: 20.
- Time allotted: 30 minutes.
- Each question carries 1 mark; there are no negative marks.
- DO NOT refresh the page.
- All the best!
Marks : 2/20
Total number of questions
20
Number of answered questions
0
Number of unanswered questions
20
Test Review : View answers and explanation for this test.
1.
Which of the following jobs are done by Common Language Runtime?
- It provides core services such as memory management, thread management, and remoting.
- It enforces strict type safety.
- It provides Code Access Security.
- It provides Garbage Collection Services.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : .NET Framework
2.
Which of the following are valid .NET CLR JIT performance counters?
- Total memory used for JIT compilation
- Average memory used for JIT compilation
- Number of methods that failed to compile with the standard JIT
- Percentage of processor time spent performing JIT compilation
- Percentage of memory currently dedicated for JIT compilation
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : .NET Framework
3.
What will be the output of the C#.NET code snippet given below?
char ch = Convert.ToChar ('a' | 'b' | 'c');
switch (ch)
{
case 'A':
case 'a':
Console.WriteLine ("case A | case a");
break;
case 'B':
case 'b':
Console.WriteLine ("case B | case b");
break;
case 'C':
case 'c':
case 'D':
case 'd':
Console.WriteLine ("case D | case d");
break;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
4.
Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
byte myByte = 153; // In Binary = 10011001 byte n = 8; // In Binary = 00001000 (Here 1 is the 4th bit from right) Now perform logical AND operation (n & myByte) 10011001 00001000 --------- 00001000 Here result is other than 0, so evaluated to True. ---------
If the result is true, then we can understand that 4th bit is ON of the given data myByte.
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
5.
What will be the output of the C#.NET code snippet given below?
int num = 1, z = 5;
if (!(num <= 0))
Console.WriteLine( ++num + z++ + " " + ++z );
else
Console.WriteLine( --num + z-- + " " + --z );
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
6.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
object[] o = new object[] {"1", 4.0, "India", 'B'};
fun (o);
}
static void fun (params object[] obj)
{
for (int i = 0; i < obj.Length-1; i++)
Console.Write(obj[i] + " ");
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
7.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i = 10;
double d = 34.340;
fun(i);
fun(d);
}
static void fun(double d)
{
Console.WriteLine(d + " ");
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
8.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Sample
{
static Sample()
{
Console.Write("Sample class ");
}
public static void Bix1()
{
Console.Write("Bix1 method ");
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample.Bix1();
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
9.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Baseclass
{
public void fun()
{
Console.Write("Base class" + " ");
}
}
class Derived1: Baseclass
{
new void fun()
{
Console.Write("Derived1 class" + " ");
}
}
class Derived2: Derived1
{
new void fun()
{
Console.Write("Derived2 class" + " ");
}
}
class Program
{
public static void Main(string[ ] args)
{
Derived2 d = new Derived2();
d.fun();
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
10.
Which one of the following statements is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Arrays
11.
Which of the following are the correct ways to define an array of 2 rows and 3 columns?
-
int[ , ] a; a = new int[2, 3]{{7, 1, 3},{2, 9, 6}};
-
int[ , ] a; a = new int[2, 3]{};
-
int[ , ] a = {{7, 1, 3}, {2, 9,6 }};
-
int[ , ] a; a = new int[1, 2];
-
int[ , ] a; a = new int[1, 2]{{7, 1, 3}, {2, 9, 6}};
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Arrays
12.
For the code snippet shown below, which of the following statements are valid?
public class TestIndiaBix
{
public void TestSub<M> (M arg)
{
Console.Write(arg);
}
}
class MyProgram
{
static void Main(string[] args)
{
TestIndiaBix bix = new TestIndiaBix();
bix.TestSub("IndiaBIX ");
bix.TestSub(4.2f);
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Generics
13.
For the code snippet shown below, which of the following statements are valid?
public class Generic<T>
{
public T Field;
public void TestSub()
{
T i = Field + 1;
}
}
class MyProgram
{
static void Main(string[] args)
{
Generic<int> gen = new Generic<int>();
gen.TestSub();
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Generics
14.
Which one of the following classes are present System.Collections.Generic namespace?
- Stack
- Tree
- SortedDictionary
- SortedArray
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Generics
15.
Which of the following statements is correct about an enum used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
16.
Which of the following CANNOT be used as an underlying datatype for an enum in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
17.
Which of the following is the correct way to implement a write only property Length in a Sample class?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Properties
18.
Which of the following statements are correct?
- The signature of an indexer consists of the number and types of its formal parameters.
- Indexers are similar to properties except that their accessors take parameters.
- Accessors of interface indexers use modifiers.
- The type of an indexer and the type of its parameters must be at least as accessible as the indexer itself.
- An interface accessor contains a body.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Properties
19.
Which of the following statements is correct about the C#.NET program given below if a value "6" is input to it?
using System;
namespace IndiabixConsoleApplication
{
class MyProgram
{
static void Main (string[] args)
{
int index;
int val = 66;
int[] a = new int[5];
try
{
Consote.Write("Enter a number: ");
index = Convert.ToInt32(Console.ReadLine());
a[index] = val;
}
catch(Exception e)
{
Console.Write("Exception occurred ");
}
Console.Write("Remaining program ");
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
20.
Which of the following statements are correct?
- All operators in C#.NET can be overloaded.
- We can use the new modifier to modify a nested type if the nested type is hiding another type.
- In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator.
- Method overloading is used to create several methods with the same name that performs similar tasks on similar data types.
- Operator overloading permits the use of symbols to represent computations for a type.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Polymorphism
*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers