csharp_onlinetest.md - brainchildservices/curriculum GitHub Wiki
ONLINE TEST
SLIDE-1
-
Which of the following keyword is used for including the namespaces in the program in C#?
- imports
- using
- exports
- None of the above.
SLIDE-2
-
How many Bytes are stored by βLongβ Data type in C# .net?
- 8
- 4
- 2
- 1
SLIDE-3
-
Correct Declaration of Values to variables βaβ and βbβ?
- int a = 32, b = 40.6;
- int a = 42; b = 40;
- int a = 32; int b = 40;
- int a = b = 42;
SLIDE-4
-
What will be the error in the following C# code?
Static Void Main(String[] args) { const int m = 100; int n = 10; const int k = n / 5 * 100 * n ; Console.WriteLine(m * k); Console.ReadLine(); }
- βkβ should not be declared constant
- Expression assigned to βkβ should be constant in nature
- Expression (m * k) is invalid
- βm β is declared in invalid format
SLIDE-5
-
Arrange the following data type in order of increasing magnitude sbyte, short, long, int.
- long < short < int < sbyte
- sbyte < short < int < long
- short < sbyte < int < long
- short < int < sbyte < long
SLIDE-6
-
Which data type should be more preferred for storing a simple number like 35 to improve execution speed of a program?
- sbyte
- short
- int
- long
SLIDE-7
-
Correct way to define a value 6.28 in a variable βpiβ where value cannot be modified?
- #define pi 6.28F
- pi = 6.28F
- const float pi = 6.28F
- const float pi; pi = 6.28F
SLIDE-8
-
What will be the output of the following C# code?
public static void Main(string[] args) { double ZERO = 0; Console.WriteLine("RESULT OF DIVISION BY ZERO IS :{0}", (0 / ZERO)); Console.ReadLine(); }
- 1
- exception argument is thrown
- NaN
- 0
SLIDE-9
-
What will be the output of the following C# code?
static void Main(string[] args) { string s1 = "Delhi"; string s2; s2 = s1.Insert (6, "Jaipur"); Console.WriteLine(s2); }
- DelhJaipuri
- Delhi Jaipur
- Delhi
- DelhiJaipur
SLIDE-10
-
What will be the output of the following C# code?
string s1 = " I AM BEST "; string s2; s2 = s1.substring (5, 4); Console.WriteLine (s2);
- AM BEST
- I AM BES
- BEST
- I AM
SLIDE-11
- Correct statement about strings are?
- a string is created on the stack
- a string is primitive in nature
- a string created on heap
- created of string on a stack or on a heap depends on the length of the string
SLIDE-12
- Storage location used by computer memory to store data for usage by an application is?
- Pointers
- Constants
- Variable
- none of above
SLIDE-13
-
What will be the output of the following C# code?
static void Main(string[] args) { String name = "Dr.Strange"; Console.WriteLine("Good Morning" + name); }
- Dr.Strange
- Good Morning
- Good Morning Dr.Strange
- Good Morning name
SLIDE-14
- Default Type of number without decimal is?
- Long Int
- Unsigned Long
- Int
- Unsigned Int
SLIDE-15
- What is the actual type of string in C#?
- System.Array
- System.char
- System.String
- None of the mentioned
REF link: