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 statements is correct about the .NET Framework?
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 benefits do we get on running managed code under CLR?
- Type safety of the code running under CLR is assured.
- It is ensured that an application would not access the memory that it is not authorized to access.
- It launches separate process for every application running under it.
- The resources are Garbage collected.
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 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
4.
Which of the following statements are correct?
- The switch statement is a control statement that handles multiple selections and enumerations by passing control to one of the case statements within its body.
- The goto statement passes control to the next iteration of the enclosing iteration statement in which it appears.
- Branching is performed using jump statements which cause an immediate transfer of the program control.
- A common use of continue is to transfer control to a specific switch-case label or the default label in a switch statement.
- The do statement executes a statement or a block of statements enclosed in {} repeatedly until a specified expression evaluates to false.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
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.
If a procedure 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 procedure?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions and Subroutines
7.
Which of the following statements are correct about constructors in C#.NET?
- Constructors cannot be overloaded.
- Constructors always have the name same as the name of the class.
- Constructors are never called explicitly.
- Constructors never return any value.
- Constructors allocate space for the object in memory.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
8.
In an inheritance chain which of the following members of base class are accessible to the derived class members?
- static
- protected
- private
- shared
- public
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
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.
We can derive a class from a base class even if the base class's source code is not available.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
We can derive from a base class even if it is present in an assembly.
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
11.
Which of the following statements is correct about the C#.NET code snippet given below?
class Trial
{
int i;
Decimal d;
}
struct Sample
{
private int x;
private Single y;
private Trial z;
}
Sample ss = new Sample();Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
12.
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
13.
Which of the following statements are correct?
- A struct can contain properties.
- A struct can contain constructors.
- A struct can contain protected data members.
- A struct cannot contain methods.
- A struct cannot contain constants.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
14.
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
15.
Which of the following statements is correct about the C#.NET code snippet given below?
enum per
{
married,
unmarried,
divorced,
spinster
}
per.married = 10;
Console.WriteLine(per.unmarried);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 the correct output for the C#.NET code snippet given below?
enum color
{
red,
green,
blue
}
color c;
c = color.red;
Console.WriteLine(c);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 statements are correct about an enum used in C#.NET?
- An enum can be declared inside a class.
- An enum can take Single, Double or Decimal values.
- An enum can be declared outside a class.
- An enum can be declared inside/outside a namespace.
- An object can be assigned to an enum variable.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
18.
All code inside finally block is guaranteed to execute irrespective of whether an exception occurs in the protected block or not.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
19.
Which of the following can be declared as a virtual in a class?
- Methods
- Properties
- Events
- Fields
- Static fields
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Polymorphism
20.
Which of the following statements is correct about an interface used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Interfaces
*** 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