Explore topic-wise MCQs in General Awareness.

This section includes 1698 Mcqs, each offering curated multiple-choice questions to sharpen your General Awareness knowledge and support exam preparation. Choose a topic below to get started.

1551.

The Default value of Boolean DataType is ?
 public static void Main(string[] args) { double ZERO = 0; Console.WriteLine("RESULT OF DIVISION BY ZERO IS :{0}", (0 / ZERO)); Console.ReadLine(); } 

A. 0
B. True
C. False
D. 1
Answer» D. 1
1552.

Which of the following statements are correct?

1. The conditional operator (?:) returns one of two values depending on the value of a Boolean expression.
2. The as operator in C#.NET is used to perform conversions between compatible reference types.
3. The &* operator is also used to declare pointer types and to dereference pointers.
4. The -> operator combines pointer dereferencing and member access.
5. In addition to being used to specify the order of operations in an expression, brackets [ ] are used to specify casts or type conversions.

A. 1, 2, 4
B. 2, 3, 5
C. 3, 4, 5
D. 1, 3, 5
Answer» B. 2, 3, 5
1553.

How many Bytes are stored by Long Datatype in C# .net?

A. 8
B. 4
C. 2
D. 1
Answer» B. 4
1554.

Choose .NET class name from which datatype UInt is derived ?

A. System.Int16
B. System.UInt32
C. System.UInt64
D. System.UInt16
Answer» C. System.UInt64
1555.

Select error in the given program :
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(); } 

A. k should not be declared constant
B. Expression assigned to k should be constant in nature
C. Expression (m * k) is invalid
D. m is declared in invalid format
Answer» C. Expression (m * k) is invalid
1556.

Arrange the following datatype in order of increasing magnitude sbyte, short, long, int.

A. Long < short < int < sbyte
B. Sbyte < short < int < long
C. Short < sbyte < int < long
D. Short < int < sbyte < long
Answer» C. Short < sbyte < int < long
1557.

Which Conversion function of Convert.TOInt32() and Int32.Parse() is efficient?

1) Int32.Parse() is only used for strings and throws argument exception for null string
2) Convert.Int32() used for datatypes and returns directly 0 for null string

A. 2
B. Both 1,2
C. 1
D. None of the mentioned
Answer» B. Both 1,2
1558.

Correct way to assign values to variable c when int a=12, float b=3.5,int c;

A. C = a + b;
B. C = int(a + b);
C. C = a + convert.ToInt32(b);
D. C = int(a + b);
Answer» D. C = int(a + b);
1559.

Which of the following statements are correct about datatypes in C#.NET?

1. Every datatype is either a value type or a reference type.
2. Value types are always created on the heap.
3. Reference types are always created on the stack.
4. Mapping of every value type to a type in Common Type System facilitates Interoperability in C#.NET.
5. Every reference type gets mapped to a type in Common Type System.

A. 1, 3
B. 2, 5
C. 1, 4
D. 3, 4
Answer» D. 3, 4
1560.

Which of the following are the correct ways to increment the value of variable a by 1?

1. ++a++;
2. a += 1;
3. a ++ 1;
4. a = a +1;
5. a = +1;

A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5
Answer» C. 3, 5
1561.

What will be the output of the C#.NET code snippet given below?
 byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write (temp + " "); temp = (byte)(b1^b2); Console.WriteLine(temp); 

A. 163 92
B. 92 163
C. 192 63
D. 0 1
Answer» B. 92 163
1562.

Which of the following are NOT Relational operators in C#.NET?

1. >=
2. !=
3. Not
4. <=
5. <>=

A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5
Answer» D. 4, 5
1563.

Which of the following statements is correct about the C#.NET code snippet given below?


int d;
d = Convert.ToInt32( !(30 < 20) );

A. A value 0 will be assigned to d.
B. A value 1 will be assigned to d.
C. A value -1 will be assigned to d.
D. The code reports an error.
Answer» C. A value -1 will be assigned to d.
1564.

Which of the following is the correct output for the C#.NET code snippet given below?
 Console.WriteLine(13 / 2 + " " + 13 % 2); 

A. 6.5 1
B. 6.5 0
C. 6 0
D. 6 1
Answer» E.
1565.

Which of the following statements are correct about the Bitwise & operator used in C#.NET?
 1. The & operator can be used to Invert a bit. 2. The & operator can be used to put ON a bit. 3. The & operator can be used to put OFF a bit. 4. The & operator can be used to check whether a bit is ON. 5. The & operator can be used to check whether a bit is OFF. 

A. 1, 2, 4
B. 2, 3, 5
C. 3, 4
D. 3, 4, 5
Answer» E.
1566.

Which of the following are Logical operators in C#.NET?

1. &&
2. ||
3. !
4. Xor
5. %

A. 1, 2, 3
B. 1, 3, 4
C. 2, 4, 5
D. 3, 4, 5
Answer» B. 1, 3, 4
1567.

What will be the output of the C#.NET code snippet given below?
 int num = 1, z = 5; if (!(num <= 0)) Console.WriteLine( ++num + z++ + " " + ++z ); else Console.WriteLine( --num + z-- + " " + --z ); 

A. 5 6
B. 6 5
C. 6 6
D. 7 7
Answer» E.
1568.

What will be the output of the C#.NET code snippet given below?
 byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + " "); temp = (byte)(b1 << b2); Console.Write (temp + " "); temp = (byte) (b2 >> 2); Console.WriteLine(temp); 

A. 102 1 38
B. 108 0 32
C. 102 0 38
D. 1 0 1
Answer» D. 1 0 1
1569.

What will be the output of the given code snippet?
 public class A { public int x; public int y; public void display() { Console.WriteLine(x + " " + y); } } class Program { static void Main(string[] args) { A obj1 = new A(); A obj2 = new A(); obj1.x = 1; obj1.y = 2; obj2 = obj1; obj1.display(); obj2.display(); } }  

A. 1 2 0 0
B. 1 2 1 2
C. 0 0 0 0
D. Run time exception
Answer» C. 0 0 0 0
1570.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { int[] nums = { 1 }; var posNums = from n in nums select Math.Pow(4 ,3); Console.Write("The values in nums: "); foreach (int i in posNums) Console.Write(i + " "); Console.WriteLine(); Console.ReadLine(); } }  

A. Run time error
B. 64
C. Compile time error
D. 81
Answer» C. Compile time error
1571.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { float x = 3.14F; int y = (int)Math.Abs(x); Console.WriteLine(y); Console.ReadLine(); } }  

A. Compile time error
B. 3.14
C. 3
D. 4
Answer» D. 4
1572.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { int x = 5; int y = (int)Math.Pow(x,2); int z = (int)Math.Pow(y, 2); Console.WriteLine(z); Console.ReadLine(); } }  

A. 25
B. 625
C. Compile time error
D. Run time error
Answer» C. Compile time error
1573.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { int[] nums = {3 ,1 ,2 ,5 ,4}; var ltAvg = from n in nums let x = nums.Average() where n < x select n; Console.WriteLine("The average is " + nums.Average()); Console.ReadLine(); } }  

A. Run time error
B. 3
C. 5
D. Compile time error
Answer» C. 5
1574.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { int y = (int)Math.Max(4,2); int z = (int)Math.Pow(y, 2); Console.WriteLine(z); Console.ReadLine(); } }  

A. 4
B. Compile time error
C. 16
D. 89
Answer» D. 89
1575.

What will be the output of the given code snippet?
 public class A { public int x; public int y; public void display() { Console.WriteLine(x + " " + y); } } class Program { static void Main(string[] args) { A obj1 = new A(); A obj2 = new A(); obj1.x = 1; obj1.y = 2; obj2 = obj1; obj1.display(); obj2.display(); } }class Program { static void Main(string[] args) { double x = 3.14; int y = (int) Math.Abs(x); Console.WriteLine(y); } }  

A. 0
B. 3
C. 3.0
D. 3.1
Answer» C. 3.0
1576.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { double x = 3.14; int y = (int) Math.Ceiling(x); Console.WriteLine(y); } }  

A. 0
B. 3
C. 3.0
D. 4
Answer» E.
1577.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { double x = 3.14; int y = (int) Math.Floor(x); Console.WriteLine(y); } }  

A. 0
B. 3
C. 3.0
D. 4
Answer» C. 3.0
1578.

Which casting among the following is allowed for the code given below?
 class A { public :int a; } class B:public A { int b; } main() { B b=new A(); //casting 1 A a=new B(); //casting 2 }  

A. Casting 1
B. Casting 2
C. Casting 1 and casting 2
D. Casting 1 nor casting 2
Answer» C. Casting 1 and casting 2
1579.

Which statement is correct about the C#.NET code snippet given below?
 Stack st = new Stack(); st.Push("Csharp"); st.Push(7.3); st.Push(8); st.Push('b'); st.Push(true);  

A. Unsimilar elements like Csharp ,7.3,8 cannot be stored in the same stack collection.
B. Boolean values can never be stored in Stack collection
C. Perfectly workable code
D. All of the mentioned
Answer» D. All of the mentioned
1580.

Which among the following is the correct way to access all the elements of the Stack collection created using the C#.NET code snippet given below?
 Stack st = new Stack(); st.Push(10); st.Push(20); st.Push(-5); st.Push(30); st.Push(6);  

A. IEnumerable e; e = st.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
B. IEnumerator e; e = st.GetEnumerator(); while(e.MoveNext()) Console.WriteLine(e.Current);
C. IEnumerable e; e = st.GetEnumerable(); while(e.MoveNext() Console.WriteLine(e.Current),
D. None of the mentioned
Answer» C. IEnumerable e; e = st.GetEnumerable(); while(e.MoveNext() Console.WriteLine(e.Current),
1581.

The correct code to access all the elements of the queue collection created using the C#.NET code snippets given below is?
 Queue q = new Queue(); q.Enqueue("Harsh"); q.Enqueue('a'); q.Enqueue(false); q.Enqueue(70); q.Enqueue(8.5);  

A. IEnumerator e; e = q.GetEnumerator(); while(e.MoveNext())Console.WriteLine(e.Current);
B. IEnumerable e; e = q.GetEnumerator(); while(e.MoveNext())
C. IEnumerable e e = q.GetEnumerable(); while(e.MoveNext()) Console.WriteLine(e.Current);
D. All of the mentioned
Answer» B. IEnumerable e; e = q.GetEnumerator(); while(e.MoveNext())
1582.

A HashTable t maintains a collection of names of states and capital city of each state.Which among the following finds out whether New delhi state is present in the collection or not?

A. T.HasValue( New delhi ),
B. T.ContainsKey( New delhi ),
C. T.HasKey( New delhi ),
D. T.ContainsValue( New delhi ),
Answer» C. T.HasKey( New delhi ),
1583.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { double x = 2.0; double y = 3.0; double z = Math.Pow( x, y ); Console.WriteLine(z); Console.ReadLine(); } }  

A. 2.0
B. 4.0
C. 8
D. 8.0
Answer» D. 8.0
1584.

What will be the output of the given code snippet?
 class Program { static void Main(string[] args) { double x = 4.772; double y = 4.76; double z = Math.Max(x, y); Console.WriteLine(z); Console.ReadLine(); } }  

A. True
B. False
C. 4.772
D. 4.76
Answer» D. 4.76
1585.

What is the value of double constant E defined in Math class?

A. Approximately 3
B. Approximately 3.14
C. Approximately 2.72
D. Approximately 0
Answer» D. Approximately 0
1586.

What is the output of the following program?
 class Test { private: static int x; public: static void fun() { cout << ++x <<    ; } }; int Test :: x =20; void main() { Test x; x.fun(); x.fun(); }  

A. 20 22
B. 20 21
C. 21 22
D. 22 23
Answer» D. 22 23
1587.

What will be the output of the following program?
 class Test { public: Test() { cout << "Test's Constructor is Called " << endl; } }; class Result { static Test a; public: Result() { cout << "Result's Constructor is Called " << endl; } }; void main() { Result b; }  

A. Test s Constructor is Called
B. Result s Constructor is Called
C. Result s Constructor Called Test s Constructor is Called
D. Test s Constructor Called Result s Constructor is Called
Answer» C. Result s Constructor Called Test s Constructor is Called
1588.

What will be the output of the given code snippet?
 public class Generic { Stack stk = new Stack(); public void push(T obj) { stk.Push(obj); } public T pop() { T obj = stk.Pop(); return obj; } } class Program { static void Main(string[] args) { Generic g = new Generic(); g.push("Csharp"); Console.WriteLine(g.pop()); Console.ReadLine(); } }public class Generic { Stack stk = new Stack(); public void push(T obj) { stk.Push(obj); } public T pop() { T obj = stk.Pop(); return obj; } } class Program { static void Main(string[] args) { Generic g = new Generic(); g.push(30); Console.WriteLine(g.pop()); Console.ReadLine(); } } 

A. 0
B. 30
C. Runtime Error
D. Compile time Error
Answer» C. Runtime Error
1589.

What does the following code block define?
 class Gen { T ob; } 

A. Generics class decleration
B. Decleration of variable
C. A simple class decleration
D. Both a &amp; b
Answer» E.
1590.

What does the following code set defines?
 public Gen(T o) { ob = o; } 

A. Generics class decleration
B. Decleration of variable
C. Generic constructor decleration
D. All of the mentioned
Answer» D. All of the mentioned
1591.

What will be the output of the given code?
 class UnsafeCode { unsafe static void Main() { int a = 2; int b = 4; int *a1 = &a; int *b1 = &b; Console.WriteLine(*a1 + *b1); } } 

A. 6
B. Print garbage value
C. Print -6
D. Print address of b + a
Answer» B. Print garbage value
1592.

What will be the output of the given code segment?
 class UnsafeCode { unsafe static void Main() { int n = 10; void* p = &n; Console.WriteLine(*p); Console.ReadLine(); } } 

A. The program will print 10
B. Run time error
C. Compile time error
D. Output is the address contained in p
Answer» D. Output is the address contained in p
1593.

Disadvantages of Explicit Conversion are ?

A. Makes program memory heavier
B. Results in loss of data
C. Potentially Unsafe
D. None of the mentioned
Answer» C. Potentially Unsafe
1594.

For the given set of code, is conversion possible?
 static void Main(string[] args) { int a = 76; char b; b = (char)a; Console.WriteLine(b); Console.ReadLine(); }

A. Compiler will generate runtime error
B. Conversion is explicit type
C. Compiler will urge for conversion from integer to character datatype
D. None of the mentioned
Answer» C. Compiler will urge for conversion from integer to character datatype
1595.

Which of the conversions are valid for the given set of code?
 static void Main(string[] args) { int a = 22; long b = 44; double c = 1.406; b = a; c = a; a = b; b = c; }

A. C = a, b = c
B. A = c, b = a
C. B = a, c = a
D. All of the mentioned
Answer» B. A = c, b = a
1596.

Predict the relevant output for the given set of code.
 static void Main(string[] args) { float sum; int i; sum = 0.0F; for (i = 1; i <= 10; i++) { sum = sum + 1 /(float)i; } Console.WriteLine("sum =" +sum); Console.ReadLine(); }

A. 2.000
B. 2.910
C. 2.928
D. 3.000
Answer» D. 3.000
1597.

Predict the output for the following set of code.
 static void Main(string[] args) { float a = 16.4f; int b = 12; float c; c = a * ( b + a) / (a - b) ; Console.WriteLine("result is :" +c); Console.ReadLine(); }

A. 106
B. 104.789
C. 105.8546
D. 103.45
Answer» D. 103.45
1598.

Predict the solution for the following set of code.
 static void Main(string[] args) { int a, b, c, x; a = 90; b = 15; c = 3; x = a - b / 3 + c * 2 - 1; Console.WriteLine(x); Console.ReadLine(); }

A. 92
B. 89
C. 90
D. 88
Answer» D. 88
1599.

Predict the solution for the following set of code .
static void Main(string[] args) { int a, b, c, x; a = 80; b = 15; c = 2; x = a - b / (3 * c) * ( a + c); Console.WriteLine(x); Console.ReadLine(); } 

A. 78
B. -84
C. 80
D. 98
Answer» C. 80
1600.

Select output for the following set of code.
static void Main(string[] args) { int a = 5; int b = 10; int c; Console.WriteLine(c = ++ a + b ++); Console.WriteLine(b); Console.ReadLine(); }

A. 11, 10
B. 16, 10
C. 16, 11
D. 15, 11
Answer» D. 15, 11