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 are parts of the .NET Framework?
- The Common Language Runtime (CLR)
- The Framework Class Libraries (FCL)
- Microsoft Published Web Services
- Applications deployed on IIS
- Mobile Applications
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 are correct about data types?
- Each value type has an implicit default constructor that initializes the default value of that type.
- It is possible for a value type to contain the null value.
- All value types are derived implicitly from System.ValueType class.
- It is not essential that local variables in C# must be initialized before being used.
- Variables of reference types referred to as objects and store references to the actual data.
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?
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
4.
Which of the following statements are correct about datatypes in C#.NET?
- Every datatype is either a value type or a reference type.
- Value types are always created on the heap.
- Reference types are always created on the stack.
- Mapping of every value type to a type in Common Type System facilitates Interoperability in C#.NET.
- Every reference type gets mapped to a type in Common Type System.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
5.
The C#.NET code snippet given below generates ____ numbers series as output?
int i = 1, j = 1, val;
while (i < 25)
{
Console.Write(j + " ");
val = i + j;
j = i;
i = val;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
6.
What will be the output of the C#.NET code snippet given below?
int i, j = 1, k;
for (i = 0; i < 5; i++)
{
k = j++ + ++j;
Console.Write(k + " ");
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
7.
Which of the following statements are correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class Sample
{
int i, j;
public void SetData(int ii, int jj)
{
this.i = ii;
this.j = jj
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample s1 = new Sample();
s1.SetData(10, 2);
Sample s2 = new Sample();
s2.SetData(5, 10);
}
}
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Classes and Objects
8.
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
9.
Which of the following statements are correct about the C#.NET code snippet given below?
int[] a = {11, 3, 5, 9, 4};
- The array elements are created on the stack.
- Refernce a is created on the stack.
- The array elements are created on the heap.
- On declaring the array a new array class is created which is derived from System.Array Class.
- Whether the array elements are stored in the stack or heap depends upon the size of the array.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Arrays
10.
Multiple inheritance is different from multiple levels of inheritance.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
Multiple inheritance means deriving a class from more than one classes. On the other hand, multiple levels of inheritance means a class has been derived from a base class and the base class itself has been derived from another base class. Multiple inheritance is not permitted in C#.NET.
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
11.
It is illegal to make objects of one class as members of another class.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
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()
{
Sample x = new Sample();
x.i = 10;
fun(x);
Console.Write(x.i + " ");
}
static void fun(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 about Structures used in C#.NET?
- A Structure can be declared within a procedure.
- Structs can implement an interface but they cannot inherit from another struct.
- struct members cannot be declared as protected.
- A Structure can be empty.
- It is an error to initialize an instance field in a struct.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
14.
Which of the following forms of applying an attribute is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Attributes
15.
Which of the following will be the correct output for the C#.NET code snippet given below?
enum color : int
{
red = -3,
green,
blue
}
Console.Write( (int) color.red + ", ");
Console.Write( (int) color.green + ", ");
Console.Write( (int) color.blue );Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
16.
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
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 C#.NET code snippets will correctly print "Hello C#.NET"?
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 statement is correct about the C#.NET code snippet given below?
public class Sample
{
public int x;
public virtual void fun()
{ }
}
public class DerivedSample : Sample
{
new public void fun()
{ }
}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 is the correct implementation of the interface given below?
interface IMyInterface
{
double MyFun(Single i);
}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