Quiz

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

C# is a programming language, developed by?

A. Oracle
B. Microsoft
C. GNU project
D. Google
ANSWER: B

C# runs on the ___?


A. DotNET Framework
B. Java Virtual Machine
C. Both A. and B.
D. None of the above
ANSWER: A

C# programming language is used to develop?


A. Web apps
B. Desktop apps
C. Mobiles apps
D. All of the above
ANSWER: D

Is C# an object-oriented programming language?


A. Yes
B. No
ANSWER: A

What is the extension of a C# language file?


A. .c
B. .cpp
C. .cs
D. .csp
ANSWER: C

What is the correct syntax to declare a variable in C#?


A. ype variableName = value;
B. ype variableName;
C. ariableName as type = value;
D. oth A. and B.
ANSWER: D

What is the correct syntax to define a C# constant?


A. onst type constant_name;
B. onst type constant_name = value;
C. onst constant_name as type;
D. onst constant_name as type = value;
ANSWER: B

Which is the correct order for implicit type conversion to convert a smaller to a
larger type in C#?
A. har -> int -> long -> float -> double
B. ool -> char -> int -> long -> float -> double
C. har -> int -> float -> long -> double
D. ool -> char -> int -> long -> double -> float
ANSWER: A

What will be the output of the following C# code:using System;namespace


MyApplication { class Program { static void Main(string[] args) { bool x =
true; Console.Write(Convert.ToString(x)); } }} ?
A. rue
B. rue
C. alse
D. alse
ANSWER: A

What will be the output of the following C# code, if the input is 123:using
System;namespace MyApplication { class Program { static void Main(string[] args) {
Console.WriteLine("Enter a number:"); int num = Console.ReadLine();
Console.WriteLine("Given number is: " + num); } }}?
A. iven number is:123
B. iven number is: 123
C. iven number is: "123"
D. rror
ANSWER: D

Which statement is correct about the following C# statement int[] x= {10, 20, 30};?
A. x' is a reference to the array created on stack
B. x' is a reference to an object created on stack
C. x' is a reference to an object of a 'System.Array' class
D. None of the above
ANSWER: C

Which of the correct syntax to declare an array with 2 rows and 3 columns in C#?
A. int arr[2][3] = new int[2][3];
B. int arr[2,3] = new int[2,3];
C. int[,] arr = new int[2,3];
D. int [,]arr = new [2,3]int;
ANSWER: C

In C#, the objects created using new operator are stored in ___?
A. Cache Memory
B. Stack Memory
C. Heap Memory
D. None of the above
ANSWER: C

Choose the keyword which declares the indexer?


A. base
B. this
C. super
D. extract
ANSWER: B

Choose the correct statement among the following?


A. A property can be a static member whereas an indexer is always an instance
member
B. A get accessor of a property corresponds to a method with no parameters whereas
get accessor of an indexer corresponds to a method with the same formal parameters
lists as the indexer
C. It is an error for indexer to declare a local variable with the same name as
indexer parameters
D. All of the mentioned
ANSWER: D

Choose the correct option among the following indexers which correctly allows to
index in same way as an array?
A. A class
B. An interface
C. A function
D. A property
ANSWER: A

You might also like