Online C# Programming Test - C# Programming Test - Random
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 constitutes the .NET Framework?
- ASP.NET Applications
- CLR
- Framework Class Library
- WinForm Applications
- Windows 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.
Which of the following statement correctly assigns a value 33 to a variable c?
byte a = 11, b = 22, c;Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
4.
What will be the output of the following code snippet when it is executed?
int x = 1;
float y = 1.1f;
short z = 1;
Console.WriteLine((float) x + y * z - (x += (short) y));Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
5.
Which of the following statements are correct?
- We can assign values of any type to variables of type object.
- When a variable of a value type is converted to object, it is said to be unboxed.
- When a variable of type object is converted to a value type, it is said to be boxed.
- Boolean variable cannot have a value of null.
- When a value type is boxed, an entirely new object must be allocated and constructed.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
6.
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
7.
What will be the output of the code snippet given below?
int i;
for(i = 0; i<=10; i++)
{
if(i == 4)
{
Console.Write(i + " "); continue;
}
else if (i != 4)
Console.Write(i + " "); else
break;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
8.
Which of the following statements are correct about functions and subroutines used in C#.NET?
- A function cannot be called from a subroutine.
- The ref keyword causes arguments to be passed by reference.
- While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control passes back to the calling method.
- A subroutine cannot be called from a function.
- Functions and subroutines can be called recursively.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
9.
Which of the following statements are correct about the this reference?
- this reference can be modified in the instance member function of a class.
- Static functions of a class never receive the this reference.
- Instance member functions of a class always receive a this reference.
- this reference continues to exist even after control returns from an instance member function.
- While calling an instance member function we are not required to pass the this reference explicitly.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
10.
Which 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 : Constructors
11.
Which of the following is the correct output of the C#.NET code snippet given below?
int[][] a = new int[2][];
a[0] = new int[4]{6, 1, 4, 3};
a[1] = new int[3]{9, 2, 7};
Console.WriteLine(a[1].GetUpperBound(0));Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Arrays
12.
A class D can be derived from a class C, which is derived from a class B, which is derived from a class A.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
This is known as multiple levels of inheritance.
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
13.
Which of the following statements about a String is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Strings
14.
Which of the following will be the correct output for the C#.NET program given below?
namespace IndiabixConsoleApplication
{
struct Sample
{
public int i;
}
class MyProgram
{
static void Main(string[] args)
{
Sample x = new Sample();
x.i = 10;
fun(ref x);
Console.Write(x.i + " ");
}
public static void fun(ref Sample y)
{
y.i = 20;
Console.Write(y.i + " ");
}
}
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
15.
Which of the following statements are correct about the delegate declaration given below?
delegate void del(int i);
- On declaring the delegate a class called del will get created.
- The signature of del need not be same as the signature of the method that we intend to call using it.
- The del class will be derived from the MulticastDelegate class.
- The method that can be called using del should not be a static method.
- The del class will contain a one-argument constructor and an lnvoke() method.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
16.
Which of the following is the correct output for the C#.NET code snippet given below?
enum color
{
red,
green,
blue
}
color c = color.red;
Type t;
t = c.GetType();
string[ ]str;
str = Enum.GetNames(t);
Console.WriteLine(str[ 0 ]);Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
17.
How many enumerators will exist if four threads are simultaneously working on an ArrayList object?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
18.
Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below?
Queue q = new Queue();
q.Enqueue("Sachin");
q.Enqueue('A');
q.Enqueue(false);
q.Enqueue(38);
q.Enqueue(5.4);Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
19.
Which of the following statements are correct about exception handling in C#.NET?
- try blocks cannot be nested.
- In one function, there can be only one try block.
- An exception must be caught in the same function in which it is thrown.
- All values set up in the exception object are available in the catch block.
- While throwing a user-defined exception multiple values can be set in the exception, object.
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 about exception handling in C#.NET?
- If an exception occurs then the program terminates abruptly without getting any chance to recover from the exception.
- No matter whether an exception occurs or not, the statements in the finally clause (if present) will get executed.
- A program can contain multiple finally clauses.
- A finally clause is written outside the try block.
- finally clause is used to perform clean up operations like closing the network/database connections.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
*** 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