Online C# Programming Test - C# Programming Test 5
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 is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Datatypes
2.
Which of the following statement correctly assigns a value 33 to a variable c?
byte a = 11, b = 22, c;
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 Bitwise | operator used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
4.
Which of the following statements are correct about the Bitwise & operator used in C#.NET?
- The & operator can be used to Invert a bit.
- The & operator can be used to put ON a bit.
- The & operator can be used to put OFF a bit.
- The & operator can be used to check whether a bit is ON.
- The & operator can be used to check whether a bit is OFF.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Operators
5.
A function can be used in an expression, whereas a subroutine cannot be.
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 is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
7.
Can static procedures access instance data?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors
8.
Which of the following statements are correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class index
{
protected int count;
public index()
{
count = 0;
}
}
class index1: index
{
public void increment()
{
count = count +1;
}
}
class MyProgram
{
static void Main(string[] args)
{
index1 i = new index1();
i.increment();
}
}
}
- count should be declared as public if it is to become available in the inheritance chain.
- count should be declared as protected if it is to become available in the inheritance chain.
- While constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class.
- Constructor of index class does not get inherited in index1 class.
- count should be declared as Friend if it is to become available in the inheritance chain.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
9.
Which of the following statements should be added to the subroutine fun( ) if the C#.NET code snippet given below is to output 9 13?
class BaseClass
{
protected int i = 13;
}
class Derived: BaseClass
{
int i = 9;
public void fun()
{
// [*** Add statement here ***]
}
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Inheritance
10.
When would a structure variable get destroyed?
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 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
12.
Which of the following is the necessary condition for implementing delegates?
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 a delegate?
- Inheritance is a prerequisite for using delegates.
- Delegates are type-safe.
- Delegates provide wrappers for function pointers.
- The declaration of a delegate must match the signature of the method that we intend to call using it.
- Functions called using delegates are always late-bound.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Delegates
14.
Attributes can be applied to
- Method
- Class
- Assembly
- Namespace
- Enum
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 statements are valid about generics in .NET Framework?
- Generics is a language feature.
- We can create a generic class, however, we cannot create a generic interface in C#.NET.
- Generics delegates are not allowed in C#.NET.
- Generics are useful in collection classes in .NET framework.
- None of the above
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Generics
16.
Which of the following statements are correct about enum used in C#.NET?
- Every enum is derived from an Object class.
- Every enum is a value type.
- There does not exist a way to print an element of an enum as a string.
- Every enum is a reference type.
- The default underlying datatype of an enum is int.
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 inC#.NET?
- To use the keyword enum, we should either use [enum] or System.Enum.
- enum is a keyword.
- Enum is class declared in System.Type namespace.
- Enum is a class declared in the current project's root namespace.
- Enum is a class declared in System namespace.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
18.
Which of the following statements are correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
(
class Sample
{
private enum color : int
{
red,
green,
blue
}
public void fun()
{
Console.WriteLine(color.red);
}
}
class Program
{
static void Main(string[ ] args)
{
// Use enum color here
}
}
}
- To define a variable of type enum color in Main(), we should use the statement, color c; .
- enum color being private it cannot be used in Main().
- We must declare enum color as public to be able to use it outside the class Sample.
- To define a variable of type enum color in Main(), we should use the statement, Sample.color c; .
- We must declare private enum color outside the class to be able to use it in Main().
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Enumerations
19.
Which of the following statements is correct about the using statement used in C#.NET?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
20.
Which of the following is correct way to rewrite the C#.NET code snippet given below?
using Microsoft.VisualBasic;
using System.Windows.Forms;
MessageBox.Show("Wait for a" + ControlChars.CrLf + "miracle");
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Namespaces
*** 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