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 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 statements is correct about the C#.NET code snippet given below?
short s1 = 20;
short s2 = 400;
int a;
a = s1 * s2;
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
3.
Which of the following statements is correct about the C#.NET code snippet given below?
switch (id)
{
case 6:
grp = "Grp B";
break;
case 13:
grp = "Grp D";
break;
case 1:
grp = "Grp A";
break;
case ls > 20:
grp = "Grp E";
break ;
case Else:
grp = "Grp F";
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 put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
5.
Which of the following is NOT an Arithmetic operator in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
6.
Which of the following statements are correct about functions used
in C#.NET?
- Function definitions cannot be nested.
- Functions can be called recursively.
- If we do not return a value from a function then a value -1 gets returned.
- To return the control from middle of a function exit function should be used.
- Function calls can be nested.
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 = 5;
int j;
fun1(ref i);
fun2(out j);
Console.WriteLine(i + ", " + j);
}
static void funl(ref int x)
{
x = x * x;
}
static void fun2(out int x)
{
x = 6;
x = x * x;
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
8.
If a function fun() is to receive an int, a Single & a double and it is to return a decimal then which of the following is the correct way of defining this function?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
9.
Is it possible for you to prevent an object from being created by using zero argument constructor?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
10.
Which of the following snippets are the correct way to convert a Single into a String?
Single f = 9.8f; String s; s = (String) (f);
Single f = 9.8f; String s; s = Convert.ToString(f);
Single f = 9.8f; String s; s = f.ToString();
Single f = 9.8f; String s; s = Clnt(f);
Single f = 9.8f; String s; s = CString(f);
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Strings
11.
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
12.
Suppose a Generic class called SortObjects is to be made capable of sorting objects of any type (Integer, Single, Byte etc.). Which of the following programming constructs should be used to implement the comparision function?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
13.
Which of the following correctly describes the contents of the filename AssemblyInfo.cs?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Attributes
14.
For the code snippet given below, which of the following statements are valid?
public class MyContainer<T> where T: class, IComparable
{
//Insert code here
}
- Class MyContainer requires that it's type argument must implement IComparable interface.
- Compiler will report an error for this block of code.
- There are multiple constraints on type argument to MyContainer class.
- Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.
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 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
16.
Which of the following is NOT an interface declared in System.Collections namespace?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
17.
Suppose value of the Capacity property of ArrayList Collection is set to 4. What will be the capacity of the Collection on adding fifth element to it?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
18.
If ListBox is class present in System.Windows.Forms namespace, then which of the following statements are the correct way to create an object of ListBox Class?
using System.Windows.Forms; ListBox lb = new ListBox();
using LBControl = System.Windows.Forms; LBControl lb = new LBControl();
System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox();
using LBControl lb = new System.Windows.Forms.ListBox;
using LBControl = System.Windows.Forms.ListBox; LBControl lb = new LBControl();
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
19.
Which of the following is the Object Oriented way of handling run-time errors?
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 keyword is used to overload user-defined types by defining static member functions?
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