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.

1301.

Which of the following statements are correct about data types? 1. If the integer literal exceeds the range of byte, a compilation error will occur. 2. We cannot implicitly convert non-literal numeric types of larger storage size to byte. 3. Byte cannot be implicitly converted to float. 4. A char can be implicitly converted to only int data type. 5. We can cast the integral character codes.

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

Which of the following are value types? 1. Integer 2. Array 3. Single 4. String 5. Long

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

What will be the output of the following code snippet when it is executed? int x = 1; float y = 1.1f; short z = 1; Console.WriteLine((float) x + y * z - (x += (short) y));

A. 0.1
B. 1.0
C. 1.1
D. 11
Answer» B. 1.0
1304.

Which of the following statements is correct about the C#.NET code snippet given below? short s1 = 20; short s2 = 400; int a; a = s1 * s2;

A. A value 8000 will be assigned to a.
B. A negative value will be assigned to a.
C. During arithmetic if the result exceeds the high or low value of the range the value wraps around till the other side of the range.
D. An error is reported as widening conversion cannot takes place.
Answer» B. A negative value will be assigned to a.
1305.

Which of the following statements are correct? 1. We can assign values of any type to variables of type object. 2. When a variable of a value type is converted to object, it is said to be unboxed. 3. When a variable of type object is converted to a value type, it is said to be boxed. 4. Boolean variable cannot have a value of null. 5. When a value type is boxed, an entirely new object must be allocated and constructed.

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

Which of the following statements are correct about data types? 1. Each value type has an implicit default constructor that initializes the default value of that type. 2. It is possible for a value type to contain the null value. 3. All value types are derived implicitly from System.ValueType class. 4. It is not essential that local variables in C# must be initialized before being used. 5. Variables of reference types referred to as objects and store references to the actual data.

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

Which of the following are the correct way to initialise the variables i and j to a value 10 each? int i = 10; int j = 10; int i, j; i = 10 : j = 10; int i = 10, j = 10; int i, j = 10; int i = j = 10;

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

Which of the following statement correctly assigns a value 33 to a variable c? byte a = 11, b = 22, c;

A. C = (byte) (a + b);
B. C = (byte) a + (byte) b;
C. C = (int) a + (int) b;
D. C = (int)(a + b);
Answer» B. C = (byte) a + (byte) b;
1309.

Which of the following statments are the correct way to call the method Issue() defined in the code snippet given below? namespace College { namespace Lib { class Book { public void Issue() { // Implementation code } } class Journal { public void Issue() { // Implementation code } } } } 1. College.Lib.Book b = new College.Lib.Book(); b.Issue(); 2. Book b = new Book(); b.Issue(); 3. using College.Lib; Book b = new Book(); b.Issue(); 4. using College; Lib.Book b = new Lib.Book(); b.Issue(); 5. using College.Lib.Book; Book b = new Book(); b.Issue();

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

Which of the followings are NOT a .NET namespace? 1. System.Web 2. System.Process 3. System.Data 4. System.Drawing2D 5. System.Drawing3D

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

Which among the given is not a correct way to call the method Issue() defined in the code snippet given below? class Book { public void issue() { /* code */ } } class Journel { public void issue() { /* code */ } }

A. College.Lib.Book b = new College.Lib.Book(); b.issue();
B. Book b = new Book(); b.issue();
C. using College.Lib; Book b = new Book(); b.issue();
D. All of the mentioned
Answer» C. using College.Lib; Book b = new Book(); b.issue();
1312.

If a class named csharp is present in namespace n1 as well as in namespace n2,then which of the following is the correct way to use csharp class? a) class Program { static void Main(string[] args) { import n1; csharp x = new csharp(); x.fun(); import n2; csharp y = new csharp(); y.fun(); } } b) import n1; import n2; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { n1.csharp x = new n1.csharp(); x.fun(); import n2; n2.csharp y = new n2.csharp(); y.fun(); } } } c) class Program { static void Main(string[] args) { using n1; csharp x = new csharp(); x.fun(); using n2; csharp y = new csharp(); y.fun(); } } d) using n1; using n2; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { n1.csharp x = new n1.csharp(); x.fun(); import n2; n2.csharp y = new n2.csharp(); y.fun(); } } }

A. A
B. B
C. C
D. D
Answer» D. D
1313.

Which of the following is correct way to rewrite the C#.NET code snippet given below? class student using Microsoft.VisualBasic; using System.Windows.Forms; MessageBox.Show("Wait for a" + ControlChars.CrLf + "miracle");

A. using System.Windows.Forms; using CtrlChars = Microsoft.VisualBasic.ControlChars; MessageBox.Show("Wait for a" + CrLf + "miracle");
B. class student using Microsoft.VisualBasic; using System.Windows.Forms; CtrlChars = ControlChars; MessageBox.Show("Wait for a" + CtrlChars.CrLf + "miracle");
C. class student using Microsoft.VisualBasic; using System.Windows.Forms; CtrlChars = ControlChars; MessageBox.Show ("Wait for a" + CrLf + "miracle");
D. class student using System.Windows.Forms; using CtrlChars = Microsoft.VisualBasic.ControlChars; MessageBox.Show("Wait for a" + CtrlChars.CrLf + "miracle");
Answer» E.
1314.

Which of the following statements are correct about a namespace used in C#.NET? 1. Classes must belong to a namespace, whereas structures need not. 2. Every class, struct, enum, delegate and interlace has to belong to some or the other namespace. 3. All elements of the namespace have to belong to one file. 4. If not mentioned, a namespace takes the name of the current project. 5. The namespace should be imported to be able to use the elements in it.

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

Which of the following C#.NET code snippets will correctly print Hello C#.NET ?

A. import System; namespace CompSciBitsConsoleApplication { class MyProgram { static void Main(string[] args) { Console.WriteLine("Hello C#.NET"); } } }
B. class student using System; namespace CompSciBitsConsoleApplication { class MyProgram { static void Main(string[ ] args) { WriteLine("Hello C#.NET"); } } }
C. class student using System.Console; namespace CompSciBitsConsoleApplication { class MyProgram { static void Main (string[ ] args) { WriteLine("Hello C#.NET"); } } }
D. class student using System; namespace CompSciBitsConsoleApplication { class MyProgram { static void Main(string[] args) { Console.WriteLine("Hello C#.NET"); } } }
Answer» E.
1316.

If ListBox is class present in System.Windows.Forms namespace, then which of the following statements are the correct way to create an object of ListBox Class? 1. using System.Windows.Forms; ListBox lb = new ListBox(); 2. using LBControl = System.Windows.Forms; LBControl lb = new LBControl(); 3. System.Windows.Forms.ListBox lb = new System.Windows.Forms.ListBox(); 4. using LBControl lb = new System.Windows.Forms.ListBox; 5. using LBControl = System.Windows.Forms.ListBox; LBControl lb = new LBControl();

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

What does the given code set specifies? public static int Compare(string strA, string strB)

A. Comparison is case and culture sensitive
B. Two strings A and B are compared with each other
C. Output is : >0 for (A > B), <0 for (A < B) else 0 for(A=B)
D. All of the mentioned
Answer» E.
1318.

Select the output for given set of code: static void Main(string[] args) { string s1 = "Hello" + "c" + "Sharp"; Console.WriteLine(s1); Console.ReadLine(); }

A. Hello c Sharp
B. HellocSharp
C. Compile time error
D. Hello
Answer» B. HellocSharp
1319.

What does the given code set specify? public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)

A. Comparison begins at strA[indexA] and strB[indexB] and runs for length of characters
B. Returns output > 0 for for strA > strB else < 0 for strA < strB else if strA = str B output is 0
C. Comparison is culture sensitive and if ignore case is true, comparison ignores case differences
D. All of the mentioned
Answer» E.
1320.

Which string operation does the below mentioned method define? public static string Concat(string str0, string str1)

A. Method returns a string
B. String str1 is concatenated to the end of str0
C. Can be used to concatenate any number of strings
D. All of the mentioned
Answer» E.
1321.

Method used to remove white space from string?

A. Split()
B. Substring()
C. Trim()
D. TrimStart()
Answer» D. TrimStart()
1322.

What will be the output of the given code snippet? static void Main(string[] args) { string s1 = " Ixg"; string s2 = s1.Insert(3,"i"); string s3 = s2.Insert(5, "o"); for (int i = 0; i < s3.Length; i++) Console.WriteLine(s3[i]); Console.ReadLine(); }

A. Ixgo
B. Ixig
C. Ixigo
D. Ixg
Answer» D. Ixg
1323.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { char []chars = {'a', 'b', 'c'}; String s = new String(chars); Console.WriteLine(s); Console.ReadLine(); } }

A. A
B. B
C. C
D. Abc
Answer» E.
1324.

What will be the output of given code snippet? class Program { static void Main(string[] args) { char []chars = {'a', 'b', 'c'}; String s = new String(chars); String s1 = "abcd"; int len1 = s1.Length; int len2 = s.Length; Console.WriteLine(len1 + " " + len2); Console.ReadLine(); } }

A. 4 0
B. 3 0
C. 3 4
D. 4 3
Answer» E.
1325.

What will be the output of given code snippet? class A { int i; int j; public A() { i = 1; j = 2; } } class Program { static void Main(string[] args) { A obj1 = new A(); Console.WriteLine(obj1.ToString()); Console.ReadLine(); } }

A. True
B. False
C. String associated with obj1
D. Compile time error
Answer» D. Compile time error
1326.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { String c = "Hello i love Csharp"; Boolean var; var = c.StartsWith("hello"); Console.WriteLine(var); Console.ReadLine(); } }

A. True
B. False
C. 1
D. Run time error
Answer» C. 1
1327.

What will be the output of give code snippet? class Program { static void Main(string[] args) { String s1 = "Hello i love Csharp"; StringBuilder s2 = new StringBuilder(s1); Console.WriteLine(s1.Equals(s2)); Console.ReadLine(); } }

A. True
B. False
C. 0
D. Compile time error
Answer» C. 0
1328.

What is the output for the given code snippet? class Program { static void Main(string[] args) { String s1 = "one"; String s2 = string.Concat(s1 + " " + "two"); Console.WriteLine(s2); Console.ReadLine(); } }

A. One
B. Two
C. One two
D. Two one
Answer» D. Two one
1329.

Which of these data types can be used for a method having a return statement in it?

A. Void
B. Int
C. Float
D. All of the mentioned
Answer» E.
1330.

What will be the output of the program? class box { int width; int height; int length; int volume; void volume(int height, int length, int width) { volume = width * height * length; } } class Prameterized_method { public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(3, 2, 1); Console.WriteLine(obj.volume); Console.ReadLine(); } }

A. 0
B. 1
C. 6
D. 25
Answer» D. 25
1331.

What will be the output of the given code snippet? class equality { int x; int y; boolean isequal() { return(x == y); } } class Output { public static void main(String args[]) { equality obj = new equality(); obj.x = 5; obj.y = 5; Console.WriteLine(obj.isequal()); } }

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

What will be the output of the given code snippet? class equality { public int x; public int y; public Boolean isequal() { return (x == y); } } class Program { static void Main(string[] args) { equality obj = new equality(); obj.x = 5; obj.y = 5; Console.WriteLine(obj.isequal()); Console.ReadLine(); } }

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

What will be the output of the given code snippet? class box { public int width; public int height; public int length; public int volume1; public void volume() { volume1 = width * height * length; } public void volume(int x) { volume1 = x; } } class Program { static void Main(string[] args) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(5); Console.WriteLine(obj.volume1); Console.ReadLine(); } }

A. 0
B. 5
C. 25
D. 26
Answer» C. 25
1334.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { int x, y = 1; x = 10; if(x != 10 && x / Convert.ToInt32(0) == 0) Console.WriteLine(y); else Console.WriteLine(++y); Console.ReadLine(); } }

A. 1
B. 2
C. Run time error
D. Compile time error
Answer» C. Run time error
1335.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { String c = " Hello World "; String s = c.Trim(); Console.WriteLine("""+s+"""); Console.ReadLine(); } }

A. Hello World
B. HelloWorld
C. Hello World
D. Hello
Answer» D. Hello
1336.

What will be the output of the code snippet? class Program { static void Main(string[] args) { String s1 = "CSHARP"; String s2 = s1.Replace('H','L'); Console.WriteLine(s2); Console.ReadLine(); } }

A. CSHAP
B. CSHP
C. CSHALP
D. CSHP
Answer» D. CSHP
1337.

What will be the output of the code snippet? class Program { static void Main(string[] args) { String s1 = "Hello World"; String s2 = s1.Substring(0, 4); Console.WriteLine(s2); Console.ReadLine(); } }

A. Hello
B. Hell
C. H
D. Hello World
Answer» C. H
1338.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { String s = "Hello World"; int i = s.IndexOf('o'); int j = s.LastIndexOf('l'); Console.WriteLine(i + " " + j); Console.ReadLine(); } }

A. 9 5
B. 4 9
C. 9 0
D. 9 4
Answer» C. 9 0
1339.

What will be the output of the given code snippet? class Program { static void Main(string[] args) { String c = "i love Csharp"; bool a; a = c.StartsWith("I"); Console.WriteLine(a); Console.ReadLine(); } }

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

What will be the output of the given code snippet? class Program { static void Main(string[] args) { String []chars = {"z", "x", "y", "z", "y"}; for (int i = 0; i < chars.Length; ++i) for (int j = i + 1; j < chars.Length; ++j) if(chars[i].CompareTo(chars[j]) == 0) Console.WriteLine(chars[j]); Console.ReadLine(); } }

A. Zx
B. Xy
C. Zy
D. Yz
Answer» D. Yz
1341.

What will be the output of the code snippet? static void main(String args[]) { char chars[] = {'a', 'b', 'c'}; String s = new String(chars); Console.WriteLine(s); }

A. A
B. B
C. Ab
D. Abc
Answer» E.
1342.

Which of the following statements are correct about the C#.NET code snippet given below? int[ , ] intMyArr = {{7, 1, 3}, {2, 9, 6}}; 1. intMyArr represents rectangular array of 2 rows and 3 columns. 2. intMyArr.GetUpperBound(1) will yield 2. 3. intMyArr.Length will yield 24. 4. intMyArr represents 1-D array of 5 integers. 5. intMyArr.GetUpperBound(0) will yield 2.

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

Which of the following statements are correct about the C#.NET code snippet given below? int[] a = {11, 3, 5, 9, 4}; 1. The array elements are created on the stack. 2. Refernce a is created on the stack. 3. The array elements are created on the heap. 4. On declaring the array a new array class is created which is derived from System.Array Class. 5. Whether the array elements are stored in the stack or heap depends upon the size of the array.

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

How will you complete the foreach loop in the C#.NET code snippet given below such that it correctly prints all elements of the array a? int[][]a = new int[2][]; a[0] = new int[4]{6, 1 ,4, 3}; a[1] = new int[3]{9, 2, 7}; foreach (int[ ] i in a) { /* Add loop here */ Console.Write(j + " "); Console.WriteLine(); }

A. Foreach (int j = 1; j < a(0).GetUpperBound; j++)
B. Foreach (int j = 1; j < a.GetUpperBound (0); j++)
C. Foreach (int j in a.Length)
D. Foreach (int j in i)
Answer» E.
1345.

Which of the following is the correct output of the C#.NET code snippet given below? int[ , , ] a = new int[ 3, 2, 3 ]; Console.WriteLine(a.Length);

A. 20
B. 4
C. 18
D. 10
Answer» D. 10
1346.

Which of the following statements are correct about arrays used in C#.NET? 1. Arrays can be rectangular or jagged. 2. Rectangular arrays have similar rows stored in adjacent memory locations. 3. Jagged arrays do not have an access to the methods of System.Array Class. 4. Rectangular arrays do not have an access to the methods of System.Array Class. 5. Jagged arrays have dissimilar rows stored in non-adjacent memory locations.

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

What will be the output of the given code snippet? static void Main(string[] args) { string s = " i love you"; Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e')); Console.ReadLine(); }

A. 3 5 7
B. 4 5 6
C. 3 9 6
D. 2 4 6
Answer» D. 2 4 6
1348.

What is the output of the following set of code ? static void Main(string[] args) { int i, j; int[, ] arr = new int[ 3, 3]; for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { arr[i, j] = i * 2 + i * 2; Console.WriteLine(arr[i, j]); } Console.ReadLine(); } }

A. 0,0,0 4,4,4 8,8,8
B. 4,4,4 8,8,8 12,12,12
C. 8,8,8 12,12,12 16,16,16
D. 0,0,0 1,1,1, 2,2,2
Answer» B. 4,4,4 8,8,8 12,12,12
1349.

What is the output for the following set of code? static void Main(string[] args) { char A = 'K'; char B = Convert.ToChar(76); A++; B++; Console.WriteLine(A+ " " +B); Console.ReadLine(); }

A. M L
B. U L
C. L M
D. A B
Answer» D. A B
1350.

Complete the following set of code with foreach condition : int[][]a = new int[2][]; a[0] = new int[3]{3, 4, 2}; a[1] = new int[2]{8, 5}; foreach( int[]i in a) { /* add for loop */ console.write( j+ " "); console.writeline(); }

A. Foreach (int j = 1;(j(
B. Foreach (int j = 1;(j(
C. Foreach (int j in a.Length);
D. Foreach (int j in i);
Answer» E.