Select Course            


Question No: 1:
What data type should be used when we want to store any type of data?
Options:
  1. int
  2. string
  3. double
  4. object

Correct Answer


Explanation:
All predefined and user-defined types inherit from the object type.
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 2:
What is the default value of the first enum member?
Options:
  1. 1
  2. 0

Correct Answer


Explanation:
The default value for an enum is 0. If required we can change it to 1
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 3:
_______ is the term used to describe the transformation from Value Type to reference type (object).
Options:
  1. Boxing
  2. UnBoxing
  3. Implicit Casting
  4. Explicit Casting

Correct Answer


Explanation:
Boxing refers to the conversion of Value type to an Object (Reference type).
Unboxing means conversion of Object to Value type.
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 4:
What is the o/p of following program 
class Program
{
static void Main(string[ ] args)
{
int n; char chr;
chr = (char)(65);
Console.WriteLine(chr);
chr = 'a';
n = (int)(chr);
Console.WriteLine(n);
}
}

Options:
  1. 65, a
  2. a, 65
  3. A, 97
  4. 65, A

Correct Answer


Explanation:
As per ASCII Code A=65 to Z=90 and a=97 to z=122 here casting is done.
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 5:
Can a decimal be categorized as floating point datatype?
Options:
  1. Yes
  2. No

Correct Answer


Explanation:
The decimal allows digits after decimal point, the number of digits are fixed unlike float where number of digits are not fixed.
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 6:
Structure is a _________
Options:
  1. Reference Type
  2. Value Type

Correct Answer


Explanation:
Structures are Value Types and Classes are Reference Types
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 7:
What of the following are operators supported in C#?
Options:
  1. ++ & --
  2. XOR & NOT
  3. & & sizeof
  4. * for Multiplication and \ for division

Correct Answer


Explanation:
Division Operator = "/"
& and sizeof are used in Unsafe Code blocks
XOR & NOT are not valid operators in C#
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 8:
Which of the following is valid for iterating through the loop indefinitely. 
Options:
  1. while(true) { }
  2. while(false) { }
  3. do until(false) { }
  4. do until(true) { }
  5. while (1=1) { }

Correct Answer


Explanation:
do until is not a valid statement in C#
while(1 = 1) is compilation error because condition must be logical expression for eg: while(1 == 1){ }
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 9:
Which of the following is valid about Optional Parameters?
Options:
  1. Every optional parameter must specify a default value.
  2. Any parameter of a method can be optional provided it has a default value.
  3. If a given parameter has a default value all the subsequent parameters must be optional.
  4. Every method must have at least one parameter which is optional.
  5. An optional parameter need not have default value

Correct Answer


Explanation:
Share with your friend
Please enter your friends email-id:
Post your views

Question No: 10:
Which of the following is valid about params keyword.
Options:
  1. A method can have any number of parameters with params keyword
  2. Only the last parameter of a method can be declared with params keyword
  3. Only array (of any type) parameters can have params
  4. if params parameter is present, method should not have any other parameter.
  5. If the first parameter of a method is declared with params keyword, such a method can be called without passing any argument

Correct Answer


Explanation:
1.      Only Parameters which are of type array (of any data type) can be declared as params
2.      If parameter is declared as params either a reference to the array can be passed as argument or 0 or more individual values can be passed to it.
3.      Only one parameter of a method can be declared as params parameter.
4.      It must be last parameter in the list of parameters for a given method.
5.      If we have other parameters in the list they must be before the params parameter.
Share with your friend
Please enter your friends email-id:
Post your views

1 to 10 of 1798 Next Last
 
Goto Page:
LiveZilla Live Chat Software