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 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
2.
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
3.
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
4.
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
5.
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
6.
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
7.
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
8.
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
9.
Which of the following statements are correct?
- String is a value type.
- String literals can contain any character literal including escape sequences.
- The equality operators are defined to compare the values of string objects as well as references.
- Attempting to access a character that is outside the bounds of the string results in an IndexOutOfRangeException.
- The contents of a string object can be changed after the object is created.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Strings
10.
Which of the following statements are correct about the structure declaration given below?
struct Book
{
private String name;
protected int totalpages;
public Single price;
public void Showdata()
{
Console.WriteLine(name + " " + totalpages + " " + price);
}
Book()
{
name = " ";
totalpages = 0;
price = 0.0f;
}
}
Book b = new Book();
- We cannot declare the access modifier of totalpages as protected.
- We cannot declare the access modifier of name as private.
- We cannot define a zero-argument constructor inside a structure.
- We cannot declare the access modifier of price as public.
- We can define a Showdata() method inside a structure.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Structures
11.
Which of the following statements are correct about delegates?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
12.
Which of the following are the correct ways to declare a delegate for calling the function func() defined in the sample class given below?
class Sample
{
public int func(int i, Single j)
{
/* Add code here. */
}
}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 statements are correct about inspecting an attribute in C#.NET?
- An attribute can be inspected at link-time.
- An attribute can be inspected at compile-time.
- An attribute can be inspected at run-time.
- An attribute can be inspected at design-time.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Attributes
14.
Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
15.
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
16.
Which of the following statements are correct about a HashTable collection?
- It is a keyed collection.
- It is a ordered collection.
- It is an indexed collection.
- It implements a IDictionaryEnumerator interface in its inner class.
- The key - value pairs present in a HashTable can be accessed using the Keys and Values properties of the inner class that implements the IDictionaryEnumerator interface.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Collection Classes
17.
If Sample class has a Length property with get and set accessors then which of the following statements will work correctly?
Sample.Length = 20;Sample m = new Sample(); m.Length = 10;Console.WriteLine(Sample.Length);Sample m = new Sample(); int len; len = m.Length;Sample m = new Sample(); m.Length = m.Length + 20;
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 unary operators can be overloaded?
- true
- false
- +
- new
- is
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Polymorphism
19.
A derived class can stop virtual inheritance by declaring an override as
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 way to implement the interface given below?
interface IPerson
{
String FirstName
{
get;
set;
}
}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