Online C# Programming Test - C# Programming Test 1
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 utilities can be used to compile managed assemblies into processor-specific native code?
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 value types?
- Integer
- Array
- Single
- String
- Long
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 are the correct way to initialise the variables i and j to a value 10 each?
int i = 10; int j = 10;
int i, j; i = 10 : j = 10;
int i = 10, j = 10;
int i, j = 10;
int i = j = 10;
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
4.
What is the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
public enum color
{ red, green, blue };
class SampleProgram
{
static void Main (string[ ] args)
{
color c = color.blue;
switch (c)
{
case color.red:
Console.WriteLine(color.red);
break;
case color.green:
Console.WriteLine(color.green);
break;
case color.blue:
Console.WriteLine(color.blue);
break;
}
}
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
5.
What will be the output of the C#.NET code snippet given below?
int i = 2, j = i;
if (Convert.ToBoolean((i | j & 5) & (j - 25 * 1)))
Console.WriteLine(1);
else
Console.WriteLine(0);
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Control Instructions
6.
In which of the following should the methods of a class differ if they are to be treated as overloaded methods?
- Type of arguments
- Return type of methods
- Number of arguments
- Names of methods
- Order of arguments
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
7.
Assume class B is inherited from class A. Which of the following statements is correct about construction of an object of class B?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
8.
How can you prevent inheritance from a class in C#.NET ?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
C#.NET allows sealed attribute to be used as a part of class statement. Classes declared with sealed keyword cannot be used as based class for other classes. Most important reason to do this world be to prevent behavior of a class to be changed in any way.
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
9.
If s1 and s2 are references to two strings then which of the following are the correct ways to find whether the contents of the two strings are equal?
if(s1 = s2)
if(s1 == s2)
int c; c = s1.CompareTo(s2);
if( strcmp(s1, s2) )
if (s1 is s2)
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 delegates?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
11.
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
12.
Once applied which of the following CANNOT inspect the applied attribute?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Attributes
13.
Which of the following is the correct output for the C#.NET code snippet given below?
enum color: int
{
red,
green,
blue = 5,
cyan,
magenta = 10,
yellow
}
Console.Write( (int) color.green + ", " );
Console.Write( (int) color.yellow );
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
14.
A Student class has a property called rollNo and stu is a reference to a Student object and we want the statement stu.RollNo = 28 to fail. Which of the following options will ensure this functionality?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Properties
15.
Which of the following is the correct way to implement a read 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
16.
If a namespace is present in a library then which of the following is the correct way to use the elements of the namespace?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
17.
In C#.NET if we do not catch the exception thrown at runtime then which of the following will catch it?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Exception Handling
18.
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
19.
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
20.
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
*** 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