MCQOPTIONS
Saved Bookmarks
This section includes 39 Mcqs, each offering curated multiple-choice questions to sharpen your C Sharp Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
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. |
| E. | An overflow error will be reported since the result of the multiplication exceeds the range of a Short Integer. |
| Answer» B. A negative value will be assigned to a. | |
| 2. |
How many errors are present in the program given below? |
| A. | 0 |
| B. | 1 |
| C. | 2 |
| D. | 3View Answer |
| Answer» B. 1 | |
| 3. |
What will the output of the code be? |
| A. | 200 |
| B. | 101 |
| C. | 119 |
| D. | 257View Answer |
| Answer» E. | |
| 4. |
How can you assign the binary number 101 to an integer variable? |
| A. | Var = B101 |
| B. | Var = 101 |
| C. | Var = bin(101) |
| D. | Var = Bin(101) |
| Answer» B. Var = 101 | |
| 5. |
What method does the int datatype use for storing negative numbers? |
| A. | 1’s Complement |
| B. | 2’s Complement |
| C. | 3’s Complement |
| D. | 4’s Complement |
| Answer» C. 3’s Complement | |
| 6. |
How many bits of memory does the Short datatype take up? |
| A. | 17 |
| B. | 15 |
| C. | 16 |
| D. | 14 |
| Answer» D. 14 | |
| 7. |
What datatype should one use to represent 2147483610? |
| A. | Int |
| B. | Byte |
| C. | Short |
| D. | Long |
| Answer» E. | |
| 8. |
How many bits of memory does the bool datatype occupy? |
| A. | 2 |
| B. | 4 |
| C. | 6 |
| D. | 8 |
| Answer» E. | |
| 9. |
User-defined indexes on multiple fields is called ___________ |
| A. | composite index |
| B. | secondary index |
| C. | compound index |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 10. |
In the mongo shell, you can access the creation time of the ObjectId, using the ______ method. |
| A. | getTime() |
| B. | getTimestamp() |
| C. | Timestamp() |
| D. | None of the mentioned |
| Answer» C. Timestamp() | |
| 11. |
__________ returns the JavaScript representation in the form of a string literal. |
| A. | toStringJava() |
| B. | toString() |
| C. | String() |
| D. | none of the mentioned |
| Answer» C. String() | |
| 12. |
There is _________ byte counter in BSON, starting with a random value. |
| A. | 2 |
| B. | 3 |
| C. | 4 |
| D. | None of the mentioned |
| Answer» C. 4 | |
| 13. |
The $rename operator logically performs a _______ of both the old name and the new name. |
| A. | $unset |
| B. | $set |
| C. | $Nested |
| D. | None of the mentioned |
| Answer» B. $set | |
| 14. |
Which of the field is reserved for use as a primary key? |
| A. | _id |
| B. | _uid |
| C. | _uuid |
| D. | All of the mentioned |
| Answer» B. _uid | |
| 15. |
If your driver has a version number of 2.9.1, What is the major version? |
| A. | 1 |
| B. | 2 |
| C. | 9 |
| D. | None of the mentioned |
| Answer» C. 9 | |
| 16. |
BSON is a binary representation of ________ documents. |
| A. | JSON |
| B. | XML |
| C. | JScript |
| D. | All of the mentioned |
| Answer» B. XML | |
| 17. |
An application communicates with MongoDB by way of a client library, called _____________ |
| A. | Driver |
| B. | Parent |
| C. | Rank |
| D. | None of the mentioned |
| Answer» B. Parent | |
| 18. |
Which of the following data type is depreciated? |
| A. | Double |
| B. | String |
| C. | Object |
| D. | Undefined |
| Answer» E. | |
| 19. |
Which of the following query is used to generate a new ObjectId, use the ObjectId() constructor with no argument? |
| A. | x = ObjectIdAdd() |
| B. | x = addObjectId() |
| C. | x = ObjectId() |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 20. |
Which of the following data structures are documents in MongoDB? |
| A. | All database records |
| B. | Query selectors |
| C. | Update definitions |
| D. | All of the mentioned |
| Answer» E. | |
| 21. |
MongoDB documents are composed of field-and-value pairs and have the following structure? |
| A. | field1:; value1 |
| B. | field1: value1; |
| C. | field1: value1 |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 22. |
Object_Id is similar to _________ key in Relational Databases. |
| A. | primary |
| B. | secondary |
| C. | composite |
| D. | all of the mentioned |
| Answer» B. secondary | |
| 23. |
The GridFS index allows efficient retrieval of __________ using the files_id and n values. |
| A. | chunks |
| B. | files |
| C. | bson |
| D. | none of the mentioned |
| Answer» B. files | |
| 24. |
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; | |
| 25. |
What is the size of a Decimal? |
| A. | 4 byte |
| B. | 8 byte |
| C. | 16 byte |
| D. | 32 byte |
| Answer» D. 32 byte | |
| 26. |
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 | |
| 27. |
Which of the following is the correct ways to set a value 3.14 in a variable pi such that it cannot be modified? |
| A. | float pi = 3.14F; |
| B. | #define pi 3.14F; |
| C. | const float pi = 3.14F; |
| D. | const float pi; pi = 3.14F; |
| Answer» D. const float pi; pi = 3.14F; | |
| 28. |
Which of the following is the correct size of a Decimal datatype? |
| A. | 8 Bytes |
| B. | 4 Bytes |
| C. | 10 Bytes |
| D. | 16 Bytes |
| Answer» E. | |
| 29. |
Which of the following statements are correct about data types? Each value type has an implicit default constructor that initializes the default value of that type. It is possible for a value type to contain the null value. All value types are derived implicitly from System.ValueType class. It is not essential that local variables in C# must be initialized before being used. 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 | |
| 30. |
Which of the following is the correct default value of a Boolean type? |
| A. | 0  |
| B. | 1 |
| C. | 1 |
| D. | |
| Answer» E. | |
| 31. |
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. | |
| 32. |
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 |
| C. | 1.1 |
| D. | 11 |
| Answer» B. 1 | |
| 33. |
Which of the following is NOT an Integer? |
| A. | Char |
| B. | Byte |
| C. | Integer |
| D. | Short |
| Answer» B. Byte | |
| 34. |
Which of the following are value types? Integer Array Single String Long |
| A. | 1, 2, 5 |
| B. | 1, 3, 5 |
| C. | 2, 4 |
| D. | 3, 5 |
| Answer» C. 2, 4 | |
| 35. |
Which of the following statements are correct about datatypes in C#.NET? Every datatype is either a value type or a reference type. Value types are always created on the heap. Reference types are always created on the stack. Mapping of every value type to a type in Common Type System facilitates Interoperability in C#.NET. 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 | |
| 36. |
Which of the following statements are correct? We can assign values of any type to variables of type object. When a variable of a value type is converted to object, it is said to be unboxed. When a variable of type object is converted to a value type, it is said to be boxed. Boolean variable cannot have a value of null. 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 | |
| 37. |
Which of the following does not store a sign? |
| A. | Short |
| B. | Integer |
| C. | Long |
| D. | Byte |
| Answer» E. | |
| 38. |
Which of the following is an 8-byte Integer? |
| A. | Char |
| B. | Long |
| C. | Short |
| D. | Byte |
| Answer» C. Short | |
| 39. |
Which of the following statements are correct about data types? If the integer literal exceeds the range of byte, a compilation error will occur. We cannot implicitly convert non-literal numeric types of larger storage size to byte. Byte cannot be implicitly converted to float. A char can be implicitly converted to only int data type. We can cast the integral character codes. |
| A. | 1, 3, 5 |
| B. | 2, 4 |
| C. | 3, 5 |
| D. | 1, 2, 5 |
| Answer» E. | |