Skip to content

“Master the basics of computer science: Take our comprehensive computer MCQs quiz”

“Welcome to our computer MCQs blog, where you’ll find a wealth of knowledge on all things computer science. Whether you’re a student, a professional or simply someone who’s interested in technology, our blog offers a comprehensive collection of multiple choice questions that will help you test and improve your understanding of computer fundamentals, programming languages, algorithms, and more. With regular updates, you’ll always find new and challenging questions to test your skills. So why wait? Start exploring today and take your computer science knowledge to the next level!”

CONCEPTS & THEORIES

computer-networks

Computer Networks are the groups of computers linked to each other that enables the computer to communicate with another computer and share their resources, data, and applications.There are also multiple devices or mediums which helps in the communication between two different devices which are known as Network devices. Ex: Router, Switch, Hub, Bridge.

Computer networks can be categorized into four types by their size:

1. LAN(Local Area Network)
Local Area Network is a group of computers connected to each other in a small area such as building, office. It is used for connecting two or more personal computers through a communication medium such as twisted pair, coaxial cable, etc.
2. PAN(Personal Area Network)
Personal Area Network is a network arranged within an individual person, typically within a range of 10 meters. It is used for connecting the computer devices of personal use is known as Personal Area Network.
3. MAN(Metropolitan Area Network)
A metropolitan area network is a network that covers a larger geographic area by interconnecting a different LAN to form a larger network. Government agencies use MAN to connect to the citizens and private industries.
4. WAN(Wide Area Network)
A Wide Area Network is a network that extends over a large geographical area such as states or countries.It is quite bigger network than the LAN. It is not limited to a single location, but it spans over a large geographical area through a telephone line, fibre optic cable or satellite links.

Internetwork: An internetwork is defined as two or more computer network LANs or WAN or computer network segments are connected using devices, and they are configured by a local addressing scheme. This process is known as internetworking.

IP Address (Internet Protocol address):Also, known as the Logical Address, is the network address of the system across the network. To identify each device in the world-wide-web, Internet Assigned Numbers Authority (IANA) assigns IPV4 (Version 4) address as a unique identifier for each device on the Internet.

MAC Address (Media Access Control address):Also known as physical address, is the unique identifier of each host and is associated with the NIC (Network Interface Card). It is assigned to the NIC at the time of manufacturing.

QUESTIONS

Computer Science Multiple Choice Questions(MCQs)& Answers

1 Select the modifiers which can be used with the properties?

A Private

B Public

C Protected Internal

D All of the mentioned

Answer: All of the mentioned

2 Choose the correct statements about write-only properties in C#.NET?

A Properties which can only be set

B Properties once set and hence values cannot be read back in nature

C Useful for usage in classes which store sensitive information like password of a user

D All of the mentioned

Answer: All of the mentioned

3 Consider a class maths and we had a property called a sum.b is a reference to a maths object and we want the statement b.sum = 10 to fail. Which of the following is the correct solution to ensure this functionality?

A Declare sum property with both get and set accessors

B Declare sum property with only get accessor

C Declare sum property with get, set and normal accessors

D None of the mentioned

Answer: Declare sum property with get, set and normal accessors

4 Consider a class maths and we had a property called as sum.b which is the reference to a maths object and we want the statement Console.WriteLine(b.sum)to fail. Which among the following is the correct solution to ensure this functionality?

A Declares sum property with only get accessor

B Declares sum property with only set accessor

C Declares sum property with both set and get accessor

D Declares sum property with both set, get and normal accessor

Answer: Declares sum property with only set accessor

5 If math class had add property with get and set accessors, then which of the following statements will work correctly?

A math.add = 20;

B math m = new math(); m.add = 10;

C Console.WriteLine(math.add);

D None of the mentioned

Answer: math m = new math(); m.add = 10;

6 If the math class had add property with get accessors then which of the following statements will work correctly?

A math m = new math(); m.add = 10;

B math m = new math(); m.add = m.add + 20;

C math m = new math(); int i; i = m.add;

D math.add = 20;

Answer: math m = new math(); int i; i = m.add;

7 Select the correct statement about properties of read and write in C#.NET?

A A property can simultaneously be read or write only

B A property cannot be either read only or write only

C A write only property will only have get accessor

D A read only property will only have get accessor

Answer: A read only property will only have get accessor

8 What will be the output of the following C# code?

A 0

B 120

C 1200

D Compile time error

Answer: 1200

9 What will be the output of the following C# code?

A 0

B 180

C 30

D Compile time error

Answer: 30

10 What will be the output of the following C# code?

A 30

B 75

C 80

D 0

Answer: 75

11 What will be the output of the following C# code?

A 73

B 37

C 0

D Run time error

Answer: 73

12 What will be the output of the following C# code?

A 0

B Compile time error

C Run time error

D scores had greater value : 13 scores had greater value : 32 scores1 had greater value : 40

Answer: scores had greater value : 13 scores had greater value : 32 scores1 had greater value : 40

13 Which among the following is NOT an exception?

A Stack Overflow

B Arithmetic Overflow or underflow

C Incorrect Arithmetic Expression

D All of the mentioned

Answer: Incorrect Arithmetic Expression

14 Which among the following is considered as .NET Exception class?

A Exception

B StackUnderflow Exception

C File bound Exception

D All of the mentioned

Answer: StackUnderflow Exception

15 Which of the following statements is correct about constructors in C#.NET?

A A constructor cannot be declared as private.

B A constructor cannot be overloaded.

C A constructor can be a static constructor.

D A constructor cannot access static data.

Answer: A constructor can be a static constructor.

16 Which one of the following statements is correct?

A Array elements can be of integer type only.

B The rank of an Array is the total number of elements it can contain.

C The length of an Array is the number of dimensions in the Array.

D The default value of numeric array elements is zero.

Answer: The default value of numeric array elements is zero.

17 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: 1, 2, 5

18 How many Bytes are stored by ‘Long’ Data type in C# .net?

A 8

B 4

C 2

D 1

Answer: 8

19 Choose “.NET class” name from which data type “UInt” is derived?

A System.Int16

B System.UInt32

C System.UInt64

D System.UInt16

Answer: System.UInt32

20 Correct Declaration of Values to variables ‘a’ and ‘b’?

A int a = 32, b = 40.6;

B int a = 42; b = 40;

C int a = b = 42;

D int a = 32; int b = 40;

Answer: int a = 32; int b = 40;

21 Arrange the following data type 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: sbyte < short < int < long

22 Which data type should be more preferred for storing a simple number like 35 to improve execution speed of a program?

A sbyte

B short

C int

D long

Answer: sbyte

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

i) Int32.Parse() is only used for strings and throws argument exception for null string

ii) Convert.Int32() used for data types and returns directly ‘0’ for null string

A ii

B Both i, ii

C i

D None of the mentioned

Answer: ii

24 Default Type of number without decimal is?

A Long Int.

B Unsigned Long

C Int

D Unsigned Int

Answer: Int

25 Select a convenient declaration and initialization of a floating point number:

A float somevariable = 12.502D

B float somevariable = (Double) 12.502D

C float somevariable = (float) 12.502D

D float somevariable = (Decimal)12.502D

Answer: float somevariable = (float) 12.502D

26 Number of digits upto which precision value of float data type is valid?

A Upto 6 digit

B Upto 8 digit

C Upto 9 digit

D Upto 7 digit

Answer: Upto 7 digit

27 What will be the output of the following C# code?

A method 1: method 2: 20 method 1:

B method 2: 20 method 1: method 1:

C method 1: 0 method 2: method 2:

D method 1: 20 method 1: method 2:

Answer: method 1: 20 method 1: method 2:

28 What is the process of defining a method in terms of itself, that is a method that calls itself?

A Polymorphism

B Abstraction

C Encapsulation

D Recursion

Answer: Recursion

29 What will be the output of the following C# code?

A 190, 26.78f

B 0, 26.78f

C 190, 26

D 190, 0

Answer: 190, 26

30 What will be the output of the following C# code?

A 0, 0, 0 12, 14.78

B 0, 0, 0 0, 0

C 90, 100, 12 12, 14

D 90, 100, 12 12, 14.78

Answer: 90, 100, 12 12, 14.78

31 What will be the output of the following C# code?

A 1 1 1

B 0 0 0

C 25 100000 12.34

D -25 -100000 -12.34

Answer: 25 100000 12.34

32 Which keyword is used to declare a base class method while performing overriding of base class methods?

A this

B virtual

C override

D extend

Answer: virtual

33 The process of defining a method in a subclass having same name & type signature as a method in its superclass is known as?

A Method overloading

B Method overriding

C Method hiding

D None of the mentioned

Answer: Method overriding

34 Which of the given modifiers can be used to prevent Method overriding?

A Static

B Constant

C Sealed

D final

Answer: Sealed

35 Select the correct statement from the following?

A Static methods can be a virtual method

B Abstract methods can be a virtual method

C When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overridden

D We can override virtual as well as nonvirtual methods

Answer: When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overridden

36 Which of the following cannot be used to declare a class as a virtual?

A Methods

B Properties

C Events

D Fields

Answer: Fields

37 What will be the output of the following C# code?

A 0

B 2

C 1

D Compile time error

Answer: 2

38 What will be the output of the following C# code?

A A, A

B B, B

C Compile time error

D A, B

Answer: A, B

39 Which among the following classes are used to perform the character based file operations? a) b) c) d)

A StreamReader

B InputReaderWriter

C OutputStream

D All of the mentioned

Answer: StreamReader

40 Which of these is a method used to clear all the data present in output buffers?

A clear()

B flush()

C fflush()

D close()

Answer: flush()

41 Which method of the character stream class returns the numbers of characters successfully read starting at index?

A int Read()

B int Read(char[] buffer, int index, int count)

C int ReadBlock(char[ ] buffer, int index, int count)

D none of the mentioned

Answer: int ReadBlock(char[ ] buffer, int index, int count)

42 Which method of character stream class returns the numbers of characters successfully read starting at count?

A int Read()

B int Read(char[] buffer, int index, int count)

C int ReadBlock(char[ ] buffer, int index, int count)

D none of the mentioned

Answer: int Read(char[] buffer, int index, int count)

43 Which method among the following returns the integer if no character is available?

A int peek()

B int read()

C string ReadLine()

D none of the mentioned

Answer: int peek()

44 Which of the following is used to perform all input & output operations in C#?

A streams

B Variables

C classes

D Methods

Answer: streams

45 Which of the following is a type of stream in C#?

A Integer stream

B Character stream

C Float stream

D Long stream

Answer: Character stream

46 In the given constructor declaration for character based file operation what does ‘path’ and ‘bool specifies? StreamWriter(string path, bool append)

A the name of the file to open

B specifies the full path of file

C if append is true, the file is appended to the end of the existing file

D all of the mentioned

Answer:all of the mentioned

47 The ‘ref’ keyword can be used with which among the following?

A Static function/subroutine

B Static data

C Instance function/subroutine

D All of the mentioned

Answer: Static function/subroutine

48 The topology with highest reliability is:

A Bus topology

B Star topology

C Ring topology

D Mesh topology

Answer: Mesh topology

49 Computer Network is

A Collection of hardware components and computers

B Interconnected by communication channels

C Sharing of resources and information

D All of the Above

Answer: All of the Above

50 Protocols are?

A Agreements on how communication components and DTE’s are to communicate

B Logical communication channels for transferring data

C Physical communication channels sued for transferring data

D None of above

Answer:Agreements on how communication components and DTE’s are to communicate

51 Two devices are in network if

A a process in one device is able to exchange information with a process in another device

B a process is running on both devices

C PIDs of the processes running of different devices are same

D none of the mentioned

Answer: optional

52 what is a Firewall in Computer Network?

A The physical boundary of Network

B An operating System of Computer Network

C A system designed to prevent unauthorized access

D A web browsing Software

Answer: A system designed to prevent unauthorized access

53 The IETF standards documents are called

A RFC

B RCF

C ID

D None of the mentioned

Answer: RFC

54 Which data communication method is used to transmit the data over a serial communication link?

A Simplex

B Half-duplex

C Full duplex

D All of above

Answer: Full duplex

55 Each IP packet must contain

A Only Source address

B Only Destination address

C Source and Destination address

D Source or Destination address

Answer: Source and Destination address

56 What is the minimum header size of an IP packet?

A 16 bytes

B 10 bytes

C 20 bytes

D 32 bytes

Answer:20 bytes

57 Routing tables of a router keeps track of

A MAC Address Assignments

B Port Assignments to network devices

C Distribute IP address to network devices

D Routes to use for forwarding data to its destination

Answer: Routes to use for forwarding data to its destination

58 Which of the following is not the External Security Threats?

A Front-door Threats

B Back-door Threats

C Underground Threats

D Denial of Service (DoS)

Answer: Underground Threats

59 What is the meaning of Bandwidth in Network?

A Transmission capacity of a communication channels

B Connected Computers in the Network

C Class of IP used in Network

D None of Above

Answer: Transmission capacity of a communication channels

60 Which of the following is correct regarding Class B Address of IP address

A Network bit – 14, Host bit – 16

B Network bit – 16, Host bit – 14

C Network bit – 18, Host bit – 16

D Network bit – 12, Host bit – 14

Answer: Network bit – 14, Host bit – 16

61 …………provides a connection-oriented reliable service for sending messages

A TCP

B IP

C UDP

D All of the above

Answer: TCP

62 What does Router do in a network?

A Forwards a packet to all outgoing links

B Forwards a packet to the next free outgoing link

C Determines on which outing link a packet is to be forwarded

D Forwards a packet to all outgoing links except the originated link

Answer: Determines on which outing link a packet is to be forwarded

63 What is the use of Ping command?

A To test a device on the network is reachable

B To test a hard disk fault

C To test a bug in a Application

D To test a Pinter Quality

Answer: To test a device on the network is reachable

64 What is the size of Host bits in Class B of IP address?

A 04

B 08

C 16

D 32

Answer: 16

65 Which of the following is correct in CIDR?

A Class A includes Class B network

B There are only two networks

C There are high & low class network

D There is no concept of class A, B, C networks

Answer: There is no concept of class A, B, C networks

66 Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?

A .NET class libraries

B Common Language Runtime

C Common Language Infrastructure

D Component Object Model

Answer: .NET class libraries

67 Which of the following jobs are NOT performed by Garbage Collector?

1. Freeing memory on the stack.

2. Avoiding memory leaks.

3. Freeing memory occupied by unreferenced objects.

4. Closing unclosed database collections.

5. Closing unclosed files.

A 1, 2, 3

B 3, 5

C 1, 4, 5

D 3, 4

Answer: 1, 4, 5

68 8. Which of the following .NET components can be used to remove unused references from the managed heap?

A Common Language Infrastructure

B CLR

C Garbage Collector

D Class Loader

Answer: Garbage Collector

69 Which of the following statements correctly define .NET Framework?

A It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.

B It is an environment for developing, building, deploying and executing only Web Applications.

C It is an environment for developing, building, deploying and executing Distributed Applications.

D It is an environment for developing, building, deploying and executing Web Services.

Answer: It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.

70 Which of the following constitutes the .NET Framework?

1. ASP.NET Applications

2. CLR

3. Framework Class Library

4. WinForm Applications

5. Windows Services

A 1, 2

B 2, 3

C 3, 4

D 2, 5

Answer: 2, 3

71 Which of the following assemblies can be stored in Global Assembly Cache? A. B. C. D.

A Private Assemblies

B Friend Assemblies

C Shared Assemblies

D Public Assemblies

Answer: Shared Assemblies

72 Code that targets the Common Language Runtime is known as

A Unmanaged

B Distributed

C Legacy

D Managed Code

Answer: Managed Code

73 Which of the following statements is correct about the .NET Framework?

A .NET Framework uses DCOM for achieving language interoperability.

B .NET Framework is built on the DCOM technology.

C .NET Framework uses DCOM for making transition between managed and unmanaged code.

D .NET Framework uses DCOM for creating unmanaged applications.

Answer: .NET Framework uses DCOM for making transition between managed and unmanaged code.

74 .Duck typing is implemented by using_________ keyword.

A dynamic

B object

C ref

D base

Answer: dynamic

75 Web Forms consists of a _______ and a _________ .

A CLR, CTS

B HTML Forms, Web services

C Template, Component

D Windows, desktop

Answer: Template, Component

76 The ______ parentheses that follow _____ indicate that no information is passed to Main ().

A Empty, class

B Empty, submain

C Empty, Namespace

D Empty, Main

Answer: Empty, Namespace

77 What is the wild card character in the SQL “like” statement?

A $ (Dollar)

B % (Percent)

C # (Pound)

D * (Asterisk)

Answer: % (Percent)

78 Which of the following is the root of the .NET type hierarchy?

A System.Object

B System.Base

C System.Root

D System.Parent

Answer: System.Object

79 C# doesnot support:

A abstraction

B inheritance

C multiple inheritance

D polymorphism

Answer: multiple inheritance

80 Your company uses Visual Studio.NET 2005 as its application development platform. You are developing an application using the .NET Framework 2.0. You are required to use a datatype that will store only numbers ranging from -32,768 to 32,767. Which of the following datatypes will you use to accomplish the task?

A short

B System.Int16

C string

D a and b

Answer: a and b

81 Which of the following jobs are NOT performed by Garbage Collector?

1.Freeing memory on the stack.

2.Avoiding memory leaks.

3.Freeing memory occupied by unreferenced objects.

4.Closing unclosed database collections.

5.Closing unclosed files.

A 1, 2, 3

B 3, 5

C 3, 4

D 1, 4, 5

Answer: 1, 4, 5

82 Which of the following statements is correct about Managed Code?

A Managed code is the code that runs on top of Windows.

B Managed code is the code that is written to target the services of the CLR.

C Managed code is the code where resources are Garbage Collected.

D Managed code is the code that is compiled by the JIT compilers.

Answer: Managed code is the code that is written to target the services of the CLR.

83 How does assembly versioning in .NET prevent DLL Hell?

A The runtime checks to see that only one version of an assembly is on the machine at any one time.

B .NET allows assemblies to specify the name AND the version of any assemblies they need to run.

C The compiler offers compile time checking for backward compatibility.

D It doesn.t.

Answer: .NET allows assemblies to specify the name AND the version of any assemblies they need to run.

84 Which of the following is/are not types of arrays in C#?

A Single-Dimensional

B Multidimensional

C Jagged arrays

D Jazzed arrays

Answer: Jazzed arrays

85 A variable which is declared inside a method is called a________variable

A Private

B Serial

C Static

D Local

Answer: Local

86 Which of these methods can be used to convert all characters in a String into a character array?

A CharAt()

B getChars()

C TocharArray()

D All of the mentioned

Answer: TocharArray()

87 Which of these methods of class String is used to extract all the characters from a String object?

A CHARAT()

B Remove()

C charAt()

D Replace()

Answer: Remove()

88 How is a string typically processed?

A On a character by character basis

B On a string by string basis

C Both On a character by character basis & On a string by string basis

D None of the mentioned

Answer: On a character by character basis

89 How to print \\ on the screen?

A Console.WriteLine(“\\”);

B Console.WriteLine(“\\\\”);

C Console.WriteLine(“\\\”);

D Console.WriteLine(“\\\\\\”);

Answer: Console.WriteLine(“\\\\”);

90 Which of these is used as a default specifier for a member of the class if no access specifier is used for it?

A private

B public, within its own class

C public

D protected

Answer: private

91 Which of these is used to access members of class before the object of that class is created?

A public

B static

C private

D protected

Answer: static

92 Which of these base classes are accessible to the derived class members?

A static

B protected

C private

D Shared

Answer: protected

93 What is the process by which we can control parts of a program that can access the members of a class?

A Polymorphism

B Abstraction

C Encapsulation

D Recursion

Answer: Encapsulation

94 Accessibility modifier defined in a class are?

A public, private, protected

B public, internal, protected internal

C public, private, internal, protected internal

D public, private, protected, internal, protected internal

Answer: public, private, protected, internal, protected internal

95 Which of these access specifiers must be used for main() method?

A private

B public

C protected

D None of the mentioned

Answer: private

96 Statements about ‘ref’ keyword used in C#.NET are?

A The ref keyword causes arguments to be passed by reference

B While using ‘ref’ keyword any changes made to the parameter in the method will be reflected in the variable when control is passed back to the calling method

C Ref usage eliminates overhead of copying large data items

D All of the mentioned

Answer: All of the mentioned

97 Keyword used to define call by reference parameter in C# .NET?

A &

B out

C ref

D &&

Answer: ref

98 Which statement is/are correct?

A An argument passed to a ref parameter need not be initialized first

B Variables passed as out arguments need to be initialized prior to being passed

C To use a ref parameter, only the calling method must explicitly use the ref keyword

D None of the mentioned

Answer: None of the mentioned

99 The method in which large or variable number of arguments are handled is known as ________________

A Value parameters

B Output parameters

C Parameter arrays

D None of the mentioned

Answer: Parameter arrays

100 The modifiers used to define an array of parameters or list of arguments is __________

A ref

B out

C param

D var

Answer: param

101 Which of the following statements are correct?

A C SHARP allows a function to have arguments with default values

B C SHARP allows a function to have variable number of arguments

C Params are used to specify the syntax for a function having arguments

D Omitting the return value type in method definition results into an exception

Answer: C SHARP allows a function to have variable number of arguments

102 The capability of an object in Csharp to take number of different forms and hence display behaviour as according is known as ___________

A Encapsulation

B Polymorphism

C Abstraction

D None of the mentioned

Answer: Polymorphism

103 Which of these methods is an alternative to getChars() that stores the characters in an array of bytes?

A getBytes()

B GetByte()

A giveByte()

B Give Bytes()

Answer: getBytes()

104 Which of these methods can be used to convert all characters in a String into a character array?

A CharAt()

B getChars()

C TocharArray()

D All of the mentioned

Answer: TocharArray()

105 Which of these methods of class String is used to extract all the characters from a String object?

A CHARAT()

B Remove()

C charAt()

D Replace()

Answer: Remove()

106 How is a string typically processed?

A On a character by character basis

B On a string by string basis

C Both On a character by character basis & On a string by string basis

D all of the above

Answer: On a character by character basis

107 Accessibility modifier defined in a class are?

A public, private, protected

B public, internal, protected internal

C public, private, internal, protected internal

D public, private, protected, internal, protected internal

Answer: public, private, protected, internal, protected internal

108 Choose the statements which are false in nature?

A The base class member functions can access public member functions of derived class

B An object of a derived class cannot access private member of the base class

C Private members of the base class cannot be accessed by derived class member functions or objects of derived class

D None of the mentioned

Answer: The base class member functions can access public member functions of derived class

109 Statements about ‘ref’ keyword used in C#.NET are?

A The ref keyword causes arguments to be passed by reference

B While using ‘ref’ keyword any changes made to the parameter in the method will be reflected in the variable when control is passed back to the calling method

C Ref usage eliminates overhead of copying large data items

D All of the mentioned

Answer: All of the mentioned

110 Keyword used to define call by reference parameter in C# .NET?

A &

B out

C &&

D ref

Answer: ref

110 Which statement is/are correct?

A An argument passed to a ref parameter need not be initialized first

B Variables passed as out arguments need to be initialized prior to being passed

C To use a ref parameter, only the calling method must explicitly use the ref keyword

D None of the mentioned

Answer: None of the mentioned

111 The method in which large or variable number of arguments are handled is known as ________________

A Value parameters

B Output parameters

C Parameter arrays

D None of the mentioned

Answer: Parameter arrays

112 Choose the correct statement among the following which supports the fact that C# does not allow the creation of empty structures?

A C#.NET supports creation of abstract user-defined data types using structures

B By having empty structures, it would mean that the new data types have no data associated with, which does not make any sense in C#.NET

C Basic reason to create structures is the inability to represent real life objects using standard data types offered by the language

D All of the mentioned

Answer: All of the mentioned

113 Choose the correct statement about structures as to why they are defined as value types but not reference types?

A Since space required for structure variables is allocated on stack which is a form of memory that is automatically available when a variable to be used is in scope

B Structures generally are used to represent user defined data types that consists of small amount of data in them. Hence using stack for declaration of such variables is not a problem

C All of the mentioned

D None of the mentioned

Answer: All of the mentioned

114 Choose the wrong statement about structures in C#.NET?

A Structures can be declared within a procedure

B Structures can implement an interface but they cannot inherit from another structure

C Structure members cannot be declared as protected

D A structure cannot be empty

Answer: Structures can be declared within a procedure

115 When does a structure variable get destroyed?

A When no reference refers to it, it will get garbage collected

B Depends on whether it is created using new or without new operator

C As variable goes out of the scope

D Depends on either we free its memory using free() or delete()

Answer: As variable goes out of the scope

116 Select the wrong statements among the following?

A A structure can contain properties

B A structure can contain protected data members

C A structure can contain constructors

D A structure can contain constants

Answer: A structure can contain protected data members

117 Choose the correct statements about enum used in C#.NET?

A An enum variable cannot have a private access modifier

B An enum variable can be defined inside a class or a namespace

C An enum variable cannot have a protected access modifier

D An enum variable cannot have a public access modifier

Answer: An enum variable cannot have a protected access modifier

118 Which among the following cannot be used as a datatype for an enum in C#.NET?

A short

B double

C int

D all of the mentioned

Answer: double

119 Wrong statement about enum used in C#.NET is?

A An enum can be declared inside a class

B An object cannot be assigned to an enum variable

C An enum can be declared outside a class

D An enum can have Single and Double values

Answer: An enum can have Single and Double values

120 Choose the correct statement about enum used in C#.NET?

A By default the first enumerator has a value equal to the number of elements present in the list

B Values of the enum elements cannot be populated from database

C The value of each successive enumerator is decreased by 1

D An enumerator has a white space in its name

Answer: Values of the enum elements cannot be populated from database

121 Which among the following differentiates enum in C#.NET from enum in C language?

A C is strictly a typed language, C#.NET also is a strictly typed language

B In C, language variables of enum types can be used interchangeably with integers using type casts while enum variables cannot be used as a normal integers in C#.NET

C None of the mentioned

D All of the mentioned

Answer: In C, language variables of enum types can be used interchangeably with integers using type casts while enum variables cannot be used as a normal integers in C#.NET

122 Which procedure among the following should be used to implement a ‘Has a’ or a ‘Kind of’ relationship between two entities?

A Polymorphism

B Inheritance

C Templates

D All of the mentioned

Answer: Inheritance

123 What will be the output of the following C# code?

A 2

B 10

C 1

D 0

Answer: 1

124 What will be the output of the following C# code snippet?

A 64

B 60

C 120

D 48

Answer: 48

125 What will be the output of the following C# code?

A 64

B 60

C 72

D 84

Answer: 72

126 Which of these data types is used by the operating system to manage the Recursion in Csharp?

A Array

B Queue

C Tree

D Stack

Answer: Stack

127 What will be the output of the following C# code snippet

A 24

B 30

C Compile time error

D Runtime Error

Answer: Runtime Error

128 What will be the output of the following C# code snippet?

A 24

B 0

C 12

D 1

Answer:12

129 Choose the correct statement among the followings?

A Indexers are location indicators

B Indexers are used to access class objects

C Indexer is a form of property and works in the same way as a property

D All of the mentioned

Answer: All of the mentioned

130 Choose the keyword which declares the indexer?

A base

B this

C super

D extract

Answer: this

131 Choose the operator/operators which is/are not used to access the [] operator in indexers?

A get

B set

C access

D all of the mentioned

Answer: access

132 Choose the correct statement among the following?

A A property can be a static member whereas an indexer is always an instance member

B A get accessor of a property corresponds to a method with no parameters whereas get accessor of an indexer corresponds to a method with the same formal parameters lists as the indexer

C It is an error for indexer to declare a local variable with the same name as indexer parameters

D All of the mentioned

Answer: All of the mentioned

133 Which among the following are the advantages of using indexers?

A To use collection of items at a large scale we make use of indexers as they utilize objects of class that represent the collection as an array

B Indexers are also convenient as they can also make use of different types of indexers like int, string etc

C An indexer allows an object to be indexed such as an array

D All of the mentioned

Answer: All of the mentioned

134 Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?

A try

B throw

A throws

B catch

Answer:throws

135 Which of these classes is related to all the exceptions that are explicitly thrown?

A Error

B Exception

C Throwable

D Throw

Answer: Throwable

136 What is the use of try & catch?

A It is used to manually handle the exception

B It helps to fix the errors

C It prevents automatic terminating of the program in cases when an exception occurs

D All of the mentioned

Answer: All of the mentioned

137 Choose the statement which is incorrect? a) b) c) d)

A try block does not need to be followed by catch block

B try block can be followed by finally block instead of catch block

C try can be followed by both catch and finally block

D try need not to be followed by anything

Answer: try need not to be followed by anything

138 Which of the keywords are used for the block to be examined for exceptions? a) b) c) d)

A try

B catch

C throw

D check

Answer:try

139 Which of these keywords are used for the block to handle the exceptions generated by try block?

A try

B catch

C throw

D

Answer:catch

140 Which of these keywords are used for generating an exception manually?

A try

B catch

C throw

D check

Answer:throw

141 Which of the following cannot further inspect the attribute that is once applied?

A Linker

B ASP.NET Runtime

C Language compilers

D CLR

Answer: Linker

142 To apply an attribute to an Assembly, the correct way of implementation is? a) b) c) [AssemblyDescription(“Csharp”)] d) (Assembly:AssemblyDescription(“Csharp”)]

A [AssemblyInfo: AssemblyDescription (“Csharp”)]

B [assembly: AssemblyDescription(“Csharp”)]

C To use a ref parameter, only the calling method must explicitly use the ref keyword

D None of the mentioned

Answer: None of the mentioned

143 The number of input methods defined by the stream method Console.In in C#.NET is?

A 4

B 3

C 2

D 1

Answer: 3

144 Select the correct methodS provided by Console.In?

A Read(), ReadLine()

B ReadKey(), ReadLine()

C Read(), ReadLine(), ReadKey()

D ReadKey(), ReadLine()

Answer: Read(), ReadLine(), ReadKey()

145 Choose the output returned when read() reads the character from the console?

A String

B Char

C Integer

D Boolean

Answer: Integer

146 Choose the output returned when an error condition is generated while read() reads from the console.

A False

B 0

C -1

D All of the mentioned

Answer: -1

147 Choose the object of TextReader class. a) b) c) d)

A Console.In

B Console.Out

C Console.Error

D None of the mentioned

Answer: Console.In

148 Choose the object/objects defined by the Textwriter class.

A Console.In

B Console

C Console.Error

D None of the mentioned

Answer: Console.Error

149 Choose the methods provided by Console.Out and Console.Error? a) b) c) d)

A Write

B WriteLine

C WriteKey

D Write & WriteLine

Answer: Write & WriteLine

150 Name the exception thrown by read() on failure. a) b) c) d)

A InterruptedException

B SystemException

C SystemInputException

D I/O Exception

Answer: I/O Exception

151 Which of these methods are used to read single character from the console?

A get()

B getline()

C read()

D readLine()

Answer: read()

152 Which of these method used to read strings from the console?

A get()

B getline()

C read()

D readLine()

Answer: readLine()

153 Which among the following methods are used to write characters to a string?

A StreamWriter

B StreamReader

C StringWriter

D None of the mentioned

Answer: StringWriter

154 Which method in Console enables to read individual inputs directly from the keyboard in a non line buffered manner?

A Read()

B ReadKey()

C ReadLine()

D All of the mentioned

Answer: ReadKey()

155 What is the output returned by Console if ReadLine() stores I/O error? a) b) c) d)

A 1

B 0

C False

D I/O EXCEPTION ERROR

Answer: I/O EXCEPTION ERROR

156 OSI stands for

A Open Systems Interconnection

B Online Systems Interconnection

C Open Systems Internet

D Online systems Interconnection

Answer: Open Systems Interconnection

157 Organization that is developing cooperation in realms of scientific, technological and economic activity is .

A Institute of Electrical and Electronics Engineers

B International Organization for Standardization

C American National Standards Institute

D Electronic Industries Association

Answer: International Organization for Standardization

158 Network that is usually owned privately and links devices in single office is called

A MAN

B LAN

C WAN

D Internetwork

Answer:LAN

159 Internetworking protocol is known as

A TCP

B IP

C ISP

D TCPIP

Answer: TCPIP

160 Parameter that refers to set of rules that govern data communications are called

A Forum

B Standard

C Agency

D Protocol

Answer: Protocol

161 Defacto means

A by fact

B by law

C by nature

D by network

Answer: by fact

162 Repeater is used in

A Mesh Topology

B Ring Topology

C Bus Topology

D Star Topology

Answer: Ring Topology

163 In bus topology, device linking all nodes in a network is

A Router

B DropLine

C Backbone

D hub

Answer: Backbone

164 Which of the following statements are correct about functions and subroutines used in C#.NET?

1. A function cannot be called from a subroutine.

2. The ref keyword causes arguments to be passed by reference.

3. While using ref keyword any changes made to the parameter in the method will be reflected in that variable when control passes back to the calling method.

4. A subroutine cannot be called from a function.

5. Functions and subroutines can be called recursively.

A 1, 2, 4

B 2, 3, 5

C 3, 5

D 4, 5

Answer: 2, 3, 5

165 Which of the following statements are correct?

1. C# allows a function to have arguments with default values.

2. C# allows a function to have variable number of arguments.

3. Omitting the return value type in method definition results into an exception.

4. Redefining a method parameter in the method’s body causes an exception.

5. params is used to specify the syntax for a function with variable number of arguments.

A 1, 3, 5

B 3, 4, 5

C 2, 5

D 4, 5

Answer: 2, 5

166 Which of the following statements are correct about functions used in C#.NET?

1. Function definitions cannot be nested.

2. Functions can be called recursively.

3. If we do not return a value from a function then a value -1 gets returned.

4. To return the control from middle of a function exit function should be used.

5. Function calls can be nested.

A 1, 2, 5

B 2, 3, 5

C 2, 3

D 4, 5

Answer: 1,2,5

167 How many values is a function capable of returning?

A 1

B 0

C Depends upon how many params arguments does it use.

D Any number of values.

Answer: 1

168 How many values is a subroutine capable of returning?

A 1

B Depends upon how many params arguments does it use.

C Any number of values.

D 0

Answer: 0

169 Which of the following CANNOT occur multiple number of times in a program?

A namespace

B Class

C Function

D Entrypoint

Answer: Entrypoint

170 A function can be used in an expression, whereas a subroutine cannot be.

A True

B False

Answer: True

171 Which of the following statements is correct?

A A constructor can be used to set default values and limit instantiation.

B C# provides a copy constructor.

C Destructors are used with classes as well as structures.

D A class can have more than one destructor.

Answer: A constructor can be used to set default values and limit instantiation.

172 Which of the following statements is correct about constructors?

A If we provide a one-argument constructor then the compiler still provides a zero-argument constructor.

B Static constructors can use optional arguments.

C verloaded constructors cannot use optional arguments.

D If we do not provide a constructor, then the compiler provides a zero-argument constructor.

Answer: If we do not provide a constructor, then the compiler provides a zero-argument constructor.

173 In which of the following should the methods of a class differ if they are to be treated as overloaded methods?

1. Type of arguments

2. Return type of methods

3. Number of arguments

4. Names of methods

5. Order of arguments

A 2, 4

B 3, 5

C 1, 3, 5

D 3, 4, 5

Answer: 1, 3, 5

174 Can static procedures access instance data?

A Yes

B No

Answer: No

175 Which of the following statements are correct about functions?

A C# allows a function to have arguments with default values

B Redefining a method parameter in the method’s body causes an exception

C C# allows function to have arguments with default values

D Omitting the return type in method definition results into exception

Answer: C# allows a function to have arguments with default values

176 How many values does a function return?

A 0

B 2

C 1

D any number of values

Answer: 1

177 Number of constructors a class can define is?

A 1

B 2

C Any number

D None of the mentioned

Answer: Any number

178 Correct statement about constructors in C#.NET is?

A Constructors can be overloaded

B Constructors have same name as name of the class

C Constructors are never called explicitly

D All of the mentioned

Answer: All of the mentioned

179 Which among the following is the correct statement: Constructors are used to?

A initialize the objects

B construct the data members

C initialize the objects & construct the data members

D none of the mentioned

Answer: initialize the objects

180 Can the method add() be overloaded in the following ways in C#?

public int add() { }

public float add(){ }

A True

B False

Answer: False

181 Which of the following statements is correct about constructors in C#.NET?

A A constructor cannot be declared as private

B A constructor cannot be overloaded

C A constructor can be a static constructor

D None of the mentioned

Answer: A constructor can be a static constructor

182 What is the return type of constructors?

A int

B float

C void

D none of the mentioned

Answer: none of the mentioned

183 Which method has the same name as that of its class? a) b) c) d)

A delete

B class

C constructor

D none of the mentioned

Answer: constructor

184 Which operator among the following signifies the destructor operator?

A ::

B :

C ~

D &

Answer: ~

185 The method called by clients of a class to explicitly release any resources like network, connection, open files etc. When the object is no longer required?

A Finalize()

B End()

C Dispose()

D Close()

Answer: Dispose()

186 Name a method which has the same name as that of class and which is used to destroy objects also called automatically when application is finally on process of being getting terminated.

A Constructor

B Finalize()

C Destructor

D End

Answer: Destructor

187 What will be the output of the following C# code?

A 1

B 3

C 2

D Compile Time error

Answer: 2

188 What will be the Correct statement in the following C# code?

A Index should be declared as protected if it is to become available in inheritance chain

B Constructor of sample class does not get inherited in sample 1 class

C During constructing an object referred to by z, Firstly constructor of sample class will be called followed by constructor of sample 1 class

D All of the mentioned

Answer: d

189 The following C# code is run on single level of inheritance. What will be the Correct statement in the following C# code?

A 10, 20, 30 base method

B 10, 20, 0

C compile time error

D base method

Answer: compile time error

190 What will be size of the object created depicted by C# code snippet?

A 20 bytes

B 12 bytes

C 16 bytes

D 24 bytes

Answer 24 bytes

191 What will be the output of the following C# code?

A Code executes successfully prints nothing

B This is base class constructor

C Compile time error

D None of the mentioned

Answer: Compile time error

192 Select the statement which should be added to the current C# code to get the output as 10 20?

A Console.writeline( a + ” ” + this.a);

B Console.Writeline( mybase.a + ” ” + a);

C console.writeline(a + ” ” + base.a);

D console.writeline(base.a + ” ” + a);

Answer: console.writeline(a + ” ” + base.a);

193 What will be the Correct statement in the following C# code?

A Compile time error

B b a

C b

D The program will work correctly if we replace base(a1) with base.baseclass(a1)

Answer: b

194 Which C# statement should be added in function a() of class y to get output “i love csharp”?

A x.a();

B a();

C base.a();

D x::a();

Answer: base.a();

195 Which statements are correct?

A If a base class consists of a member function fun() and a derived class do not have any function with this name. An object of derived class can access fun()

B A class D can be derived from class C, which is derived from class B which in turn is derived from class A

C If a base class and a derived class each include a member function with same name, the member function of the derived class will be called by object of derived class

D All of the mentioned

Answer: All of the mentioned

196 What will be the output of the following C# code?

A 2 1

B 1 0

C 0 2

D 1 2

Answer: 1 2

197 What will be the output of the following C# code?

A 1, 3

B 2, 3

C 1, 2

D compile time error

Answer: compile time error

198 Choose the statements which makes interface different from classes?

A Unlike classes, interfaces consists of only declaration but not implementation

B Interfaces cannot be used directly like classes to create new objects

C Interfaces consists of declaration of methods, properties events and type definitions

D All of the mentioned

Answer: All of the mentioned

199 Which of the following is the correct way of implementing an interface addition by class maths?

A class maths : addition {}

B class maths implements addition {}

C class maths imports addition {}

D none of the mentioned

Answer:class maths : addition {}

200 Does C#.NET support partial implementation of interfaces?

A True

B False

C Can’t Say

D None of the mentioned

Answer: False

201 Which of these can be used to fully abstract a class from its implementation?

A Objects

B Packages

C Interfaces

D None of the Mentioned

Answer: Interfaces

202 Access specifiers which can be used for an interface are?

A Public

B Protected

C Private

D All of the mentioned

Answer: Public

203 What will be the Correct statement in the following C# code?

A class a is an abstract class

B A method table would not be created for class a

C The definition of f1() in class a should be void a1.f1()

D None of the mentioned

Answer: The definition of f1() in class a should be void a1.f1()

204 Choose the wrong statement about ‘INTERFACE’ in C#.NET?

A An explicitly implemented member could be accessed from an instance of the interface

B Interfaces are declared public automatically

C An interface could not contain signature of the indexer

D None of the mentioned

Answer: An interface could not contain signature of the indexer

205 What will be the Correct statement in the following C# code?

A Class a could not have an instance data

B Class a is an abstract class

C Class a fully implements the interface a1

D None of the mentioned

Answer: Class a is an abstract class

206 What will be the Correct statement in the following C# code?

A Functions should be declared inside an interface

B It is workable code

C Properties cannot be declared inside an interface

D None of the mentioned

Answer: It is workable code

207 What will be the output of the following C# code?

A 0

B 2

C 4

D None of the mentioned

Answer: 4

208 What will be the output of the following C# code?

A 0 0

B 2 2

C 4 1

D 1 4

Answer: 4 1

209 What will be the output of the following C# code snippet? 1. static void Main(string[] args) 2. { 3. string h = “i lovelife”; 4. string h1 = new string(h.Reverse().ToArray()); 5. Console.WriteLine(h1); 6. Console.ReadLine(); 7. }

A efil evoli

B lifelove i

C efilevol i

D efil evol i

Answer: efilevol i

210 Which of the following statement is correct?

A reverse() method reverses some characters

B reverseall() method reverses all characters

C replace() method replaces all instances of a character with new character

D replace() method replaces first occurrence of a character in invoking string with another character

Answer: replace() method replaces all instances of a character with new character

211 Which of these classes is used to create an object whose character sequence is mutable?

A String()

B StringBuilder()

C String() & StringBuilder()

D None of the mentioned

Answer:StringBuilder()

212 Select the namespace/namespaces which consists of methods like Length(), Indexer(), Append() for manipulating the strings.

A System.Class

B System.Array

C System.Text

D None of the mentioned

Answer: System.Text

213 Select the method used to write single byte to a file?

A Write()

B Wrteline()

C WriteByte()

D All of the mentioned

Answer: WriteByte()

214 Select the namespace on which the stream classes are defined?

A System.IO

B System.Input

C System.Output

D All of the mentioned

Answer: System.IO

215 Choose the class on which all stream classes are defined?

A System.IO.stream

B Sytem.Input.stream

C System.Output.stream

D All of the mentioned

Answer: System.IO.stream

216 Choose the stream class method which is used to close the connection?

A close()

B static close()

C void close()

D none of the mentioned

Answer: void close()

217 The method used to write a single byte to an output stream?

A void WriteByte(byte value)

B int Write(byte[] buffer ,int offset ,int count)

C write()

D none of the mentioned

Answer: void WriteByte(byte value)

218 Select the method which writes the contents of the stream to the physical device.

A fflush()

B void fflush()

C void Flush()

D flush()

Answer: void Flush()

219 Select the method which returns the number of bytes from the array buffer

A void WriteByte(byte value)

B int Write(byte[] buffer, int offset, int count)

C write()

D none of the mentioned

Answer: int Write(byte[] buffer, int offset, int count)

220 Storage location used by computer memory to store data for usage by an application is?

A Pointers

B Constants

C Variable

D None of the mentioned

Answer: Variable

221 DIFFERENCE BETWEEN KEYWORDS ‘VAR’ AND ‘DYNAMIC’?

A ‘Var’ is introduced in C# (3.0) and ‘Dynamic’ is introduced in C# (4.0)

B ‘Var’ is a type of variable where declaration is done at compile time by compiler while ‘Dynamic’ declaration is achieved at runtime by compiler

C For ‘Var’ Error is caught at compile time and for ‘Dynamic’ Error is caught at runtime

D All of the mentioned

Answer: All of the mentioned

222 Scope of variable is related to definition of variable as:

i. Region of code within which variable value is valid and hence can be accessed.

ii. No, relation with region where variable is declared its value is valid in entire scope.

A i

B ii

C i, ii

D None of the mentioned

Answer: i

223 Choose effective differences between ‘Boxing’ and ‘Unboxing’.

A ‘Boxing’ is the process of converting a value type to the reference type and ‘Unboxing’ is the process of converting reference to value type

B ‘Boxing’ is the process of converting a reference type to value type and ‘Unboxing’ is the process of converting value type to reference type

C In ‘Boxing’ we need explicit conversion and in ‘Unboxing’ we need implicit conversion

D Both ‘Boxing’ and ‘Unboxing’ we need implicit conversion

Answer: ‘Boxing’ is the process of converting a value type to the reference type and ‘Unboxing’ is the process of converting reference to value type

224 What is the need for ‘Conversion of data type’ in C#?

A To store a value of one data type into a variable of another data type

B To get desired data

C To prevent situations of runtime error during change or conversion of data type

D None of the mentioned

Answer: To prevent situations of runtime error during change or conversion of data type

225 Types of ‘Data Conversion’ in C#?

A Implicit Conversion

B Explicit Conversion

C Implicit Conversion and Explicit Conversion

D None of the mentioned

Answer: Explicit Conversion

226 ‘Implicit Conversion’ follows the order of conversion as per compatibility of data type as:

A float < char < int

B char < int < float

C int < char < float

D float < int < char

Answer: char < int < float

227 The subset of ‘int’ data type is __________

A long, ulong, ushort

B long, ulong, uint

C long, float, double

D long, float, ushort

Answer: long, float, double

228 What will be the output of the following C# code?

A -25 -1000

B -1000 -25

C 25 1000

D None of the mentioned

Answer: 25 1000

229 A type of class which does not have its own objects but acts as a base class for its subclass is known as?

A Static class

B Sealed class

C Abstract class

D None of the mentioned

Answer:Abstract class

230 The modifier used to define a class which does not have objects of its own but acts as a base class for its subclass is?

A Sealed

B Static

C New

D Abstract

Answer: Abstract

231 Choose the correct statements among the following:

A An abstract method does not have implementation

B An abstract method can take either static or virtual modifiers

C An abstract method can be declared only in abstract class

D All of the mentioned

Answer: All of the mentioned

232 What will be the output of the following C# code?

A 0

B 2

C Compile time error

D 1

Answer: 2

233 What will be the output of the following C# code?

A 1, 5

B 0, 5

C 1

D 1, 3

Answer: 1, 3

234 What will be the output of the following C# code?

A 2, 10 12

B 0, 10 10

C 2, 0 2

D 0, 0 0

Answer:2, 0 2

235 If a class inheriting an abstract class does not define all of its functions then it is known as?

A Abstract

B A simple class

C Static class

D None of the mentioned

Answer: Abstract

236 Which of the following modifiers is used when an abstract method is redefined by a derived class?

A Overloads

B Override

C Base

D Virtual

Answer: Override

237 What will be the output of the following C# code?

A 0, 8

B 1, 8

C 1, 7

D 7, 1

Answer: 7, 1

238 Which among the given classes is present in System.Collection.Generic.namespace?

A Stack

B Tree

C Sorted Array

D All of the mentioned

Answer: Stack

239 Which of these is a correct way of defining generic method?

A name(T1, T2, …, Tn) { /* … */ }

B public name { /* … */ }

C class name[T1, T2, …, Tn] { /* … */ }

D name{T1, T2, …, Tn} { /* … */ }

Answer: public name { /* … */ }

240 Which of these type parameters is used for generic methods to return and accept any type of object?

A K

B N

C T

D V

Answer: T

241 In the following C# code, which of the following statements are perfectly valid? 1. public class MyContainer where T: class, IComparable 2. { 3. /* insert code here */ 4. }

A Class MyConatiner requires that its type argument must implement Icomparable interface

B There are multiple constraints on type argument to MyConatiner class

C Compiler will report an error

D None of the mentioned

Answer: There are multiple constraints on type argument to MyConatiner class

242 In the following C# code, which statements are perfectly valid?

A Run time exception error

B Compile time error

C Code runs successfully and prints required output

D none of the mentioned

Answer: Code runs successfully and prints required output

243 Which of the given statements are valid about generics in .NET Framework?

A generics are useful in collection classes in .NET framework

B generics delegates are not allowed in C#.NET

C generics is a not language feature

D all of the mentioned

Answer: generics are useful in collection classes in .NET framework

244 Which statement is valid for the following C# code snippet?

A Compile time error

B Generic being a keyword cannot be used as a class name

C Runtime error

D Code runs successfully

Answer: Code runs successfully

245 What will be the output of the following C# code?

A Compile time error

B A

C Run time error

D Code runs successfully but prints nothing

Answer: A

246 Which of the following is a valid statement about generic procedures in C#.NET are?

A All procedures in a Generic class are generic

B Generic procedures should take at least one type parameter

C Only those procedures labeled as Generic are Generic

D None of the mentioned

Answer: Generic procedures should take at least one type parameter

247 In the following C# code, which of the following statements are perfectly valid? 1. public class MyContainer where T: IComparable 2. { 3. /* insert code here */ 4. }

A Class MyConatiner requires that its type argument must implement Icomparable interface

B There are multiple constraints on type argument to MyContainer class

C Type argument of class MyContainer should be Icomparable

D None of the mentioned

Answer: Class MyConatiner requires that its type argument must implement Icomparable interface

248 Which of the following statements are valid in the following C# code snippet?

A code runs successfully but prints nothing

B code runs successfully and prints 1

C program will give run time error

D compile time error

Answer: compile time error

249 Which among the given classes represents System.Collections.Generic namespace?

A SortedDictionary

B Sorted Array

C Stack

D All of the mentioned

Answer: SortedDictionary

250 What will be the output of the following C# code snippet?

A Compile time error

B Csharp

C 0

D Run time error

Answer: Csharp

251 Choose the correct way to call subroutine fun() of the sample class?

A delegate void del(int i); x s = new x(); del d = new del(ref s.x); d(8, 2.2f);

B delegate void del(int p, double k); del d; x s = new x(); d = new del(ref s.x); d(8, 2.2f);

C x s = new x(); delegate void d = new del(ref x); d(8, 2.2f);

D all of the mentioned

Answer: delegate void del(int p, double k); del d; x s = new x(); d = new del(ref s.x); d(8, 2.2f);

252 Which of the following is the correct way to call the subroutine function abc() of the given class in the following C# code?

A csharp c = new csharp(); delegate void d = new del(ref abc); d();

B delegate void del(); del d; csharp s = new csharp(); d = new del(ref s.abc); d();

C csharp s = new csharp(); delegate void del = new delegate(ref abc); del();

D None of the mentioned

Answer: delegate void del(); del d; csharp s = new csharp(); d = new del(ref s.abc); d();

253 Which of the following is the correct way to call the function abc() of the given class in the following C# code?

A delegate void del(int a); csharp s = new csharp(); del d = new del(ref s.abc); d(10);

B csharp s = new csharp(); delegate void d = new del(ref abc); d(10);

C delegate int del(int a); del d; csharp s = new csharp(); d = new del(ref s.fun); d(10);

D none of the mentioned

Answer: delegate int del(int a); del d; csharp s = new csharp(); d = new del(ref s.fun); d(10);

254 ADSL is the abbreviation of

A Asymmetric Dual Subscriber Line

B Asymmetric Digital System Line

C Asymmetric Dual System Line

D Asymmetric Digital Subscriber Line

Answer: Asymmetric Digital Subscriber Line

255 How many layers does OSI Reference Model has?

A 4

B 5

C 6

D 7

Answer: 7

256 Bridge works in which layer of the OSI model?

A Appliation layer

B Transport layer

C Network layer

D Datalink layer

Answer: Datalink layer

257 Why IP Protocol is considered as unreliable?

A A packet may be lost

B Packets may arrive out of order

C Duplicate packets may be generated

D All of the above

Answer: All of the above

258 What is the benefit of the Networking?

A File Sharing

B Easier access to Resources

C Easier Backups

D All of the Above

Answer: All of the Above

259 Which of the following is not the Networking Devices?

A Gateways

B Linux

C Routers

D Firewalls

Answer:Linux

260 What is the maximum header size of an IP packet?

A 32 bytes

B 64 bytes

C 30 bytes

D 60 bytes

Answer: Creates the class Test that inherits the class Form

261 Which of the following is correct in VLSM?

A Can have subnets of different sizes

B Subnets must be in same size

C No required of subnet

D All of above

Answer: Can have subnets of different sizes

262 DHCP Server provides _____ to the client.

A Protocol

B IP Address

C MAC Address

D Network Address

Answer: IP Address

263 What is the address size of IPv6 ?

A 32 bit

B 64 bit

C 128 bit

D 256 bit c

Answer: 128 bit

264 Which of the following statement is correct about a string in C#.NET?

A The System.Array class is used to represent a string

B A string has a zero-based index

C A number cannot be represented in the form of a string

D A string is mutable because it can be modified once it has been created

Answer: A string has a zero-based index

265 Correct way to find if contents of two strings are equal?

A if (s1 = s2)

B if (s1 != s2)

C if (strcmp (s1 ,s2))

D if ( s1 is s2)

Answer: if (strcmp (s1 ,s2))

266 Which of the following statements are correct?

A String is value type

B String literals can contain any character literal including escape sequences

C The equality operators are defined to compare values of string objects as well as references

D All of the mentioned

Answer: String literals can contain any character literal including escape sequences

267 Which of these operators can be used to concatenate two or more String objects?

A +

B +=

C &

D ||

Answer: +

268 The Method use to remove white space from a string?

A Split()

B Substring()

C Trim()

D TrimStart()

Answer: Trim()

269 What is the String in C# meant for? a) b) c) d)

A Variable

B Character Array

C instantiates button control

D object

E Class

Answer: Object

270 What does the term ‘immutable’ means in term of string objects?

A We can modify characters included in the string

B We cannot modify characters contained in the string

C We cannot perform various operation of comparison, inserting, appending etc

D None of the mentioned

Answer: We cannot modify characters contained in the string

271 To perform comparison operation on strings supported operations are ____________

A Compare()

B Equals()

C Assignment ‘==’ operator

D All of the mentioned

Answer: All of the mentioned

272 Correct way to convert a string to uppercase using string class method()?

A Upper()

B ToUpper()

C Object.ToUpper()

D None of the mentioned

Answer: Object.ToUpper()

273 Which of these methods of class String is used to compare two String objects for their equality?

A equals()

B Equals()

C isequal()

D Isequal()

Answer: equals()

274 Which of these methods is used to compare two strings such that after comparison output returns different integer values as (0 for false, 1 for true)?

A Equals ()

B == operator

C Compare()

D None of the mentioned

Answer: Compare()

275 Which of these methods of class String is used to check whether a substring exists at the beginning of the particular string?

A StartsWith()

B EndsWith()

C Starts()

D ends()

Answer: StartsWith()

276 Which of these methods returns the string such that some characters which are specified to be removed from the end of strings are removed from string by mentioning the number of characters to be removed?

A Trim()

B Remove()

C TrimEnd()

D Split()

Answer: Trim()

277 What is the value returned by function compareTo() if the invoking string is less than the string compared?

A zero

B value less than zero

C value greater than zero

D none of the mentioned

Answer: value less than zero

278 Which of these data type values is returned by equals() method of String class?

A char

B int

C boolean

D all of the mentioned

Answer: boolean

279 Which of these keywords is used to manually throw an exception?

A try

B finally

C throw

D catch

Answer: throw

280 What will be the output of the following C# code?

A value 40 will be assigned to a[5];

B The output will be : Index out of bounds Remaining program

C The output will be : Remaining program

D None of the mentioned

Answer: The output will be : Index out of bounds Remaining program

Leave a Reply

Your email address will not be published. Required fields are marked *

ULLU Web Series New: Watch this Bold Web Series by putting the latch of the room Rani Pari Web Series List Watch Online Charmsukh Tapan Web Series: देवर और भाभी ने किया जमकर रोमांस Romantic Web Series: Enjoy this web series alone, full of bold scenes Top 10 Current Affairs In Hindi TOP 10 FACT You Have to Know
%d bloggers like this: