Explore topic-wise MCQs in Testing Subject.

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

1.

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» C. fflush()
2.

Choose the filemode method which is used to create a new output file with the condition that the file with same name if exists will destroy the old file:

A. FileMode.CreateNew
B. FileMode.Create
C. FileMode.OpenOrCreate
D. FileMode.Truncate
Answer» C. FileMode.OpenOrCreate
3.

Choose the filemode method which is used to create a new output file with the condition that the file with same name must not exist.

A. FileMode.CreateNew
B. FileMode.Create
C. FileMode.OpenOrCreate
D. FileMode.Truncate
Answer» B. FileMode.Create
4.

Which property among the following represents the current position of the stream?

A. long Length
B. long Position
C. int Length
D. all of the mentioned
Answer» B. long Position
5.

Which among the following is used for storage of unmanaged memory aspects?

A. BufferedStream
B. FileStream
C. MemoryStream
D. UnmanagedMemoryStream
Answer» E.
6.

Which among the following is used for storage of memory aspects?

A. BufferedStream
B. FileStream
C. MemoryStream
D. None of the mentioned
Answer» D. None of the mentioned
7.

Which of these data types is returned by every method of OutputStream?

A. int
B. float
C. byte
D. none of the mentioned
Answer» E.
8.

Which of these classes is used to read and write bytes in a file?

A. FileReader
B. FileWriter
C. FileInputStream
D. InputStreamReader
Answer» D. InputStreamReader
9.

Select the action of the method long seek()?

A. Attempts to readup to count bytes into buffer starting at buffer[offset]
B. Writes a single byte to an output stream
C. Sets the current position in the stream to the specified offset from specified origin and hence returns the new position
D. None of the mentioned
Answer» D. None of the mentioned
10.

Select the statements which define the stream.

A. A stream is an abstraction that produces or consumes information
B. A stream is linked to a physical device by the I/0 system
C. C# programs perform I/O through streams
D. All of the mentioned
Answer» E.
11.

Name the method which returns integer as -1 when the end of file is encountered.

A. int read()
B. int ReadByte()
C. void readbyte()
D. none of the mentioned
Answer» C. void readbyte()
12.

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» C. write()
13.

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» D. flush()
14.

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» B. int Write(byte[] buffer ,int offset ,int count)
15.

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» D. none of the mentioned
16.

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» B. Sytem.Input.stream
17.

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» B. System.Input
18.

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

A. Write()
B. Wrteline()
C. WriteByte()
D. All of the mentioned
Answer» D. All of the mentioned
19.

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» D. None of the mentioned
20.

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» C. String() & StringBuilder()
21.

Choose the correct statement about the WriteLine()?

A. Can display one or more value to the screen
B. Adds a newline character at the end of the each new output
C. Allows to output data in as many different formats
D. All of the mentioned
Answer» E.
22.

Select the objects of the class TextWriter which is/are not used to perform the write operations to the console?

A. Write()
B. WriteLine()
C. WriteError()
D. All of the mentioned
Answer» D. All of the mentioned
23.

Name the method/methods used to read byte streams from the file?

A. ReadByte()
B. Read
C. Readkey()
D. None of the mentioned
Answer» B. Read
24.

What is the output returned by Console if ReadLine() stores I/O error?

A. 1
B. 0
C. False
D. I/O EXCEPTION ERROR
Answer» E.
25.

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» C. ReadLine()
26.

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» D. None of the mentioned
27.

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

A. get()
B. getline()
C. read()
D. readLine()
Answer» E.
28.

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

A. get()
B. getline()
C. read()
D. readLine()
Answer» D. readLine()
29.

Name the exception thrown by read() on failure.

A. InterruptedException
B. SystemException
C. SystemInputException
D. I/O Exception
Answer» E.
30.

Choose the methods provided by Console.Out and Console.Error?

A. Write
B. WriteLine
C. WriteKey
D. Write & WriteLine
Answer» E.
31.

Choose the object/objects defined by the Textwriter class.

A. Console.In
B. Console
C. Console.Error
D. None of the mentioned
Answer» D. None of the mentioned
32.

Choose the object of TextReader class.

A. Console.In
B. Console.Out
C. Console.Error
D. None of the mentioned
Answer» B. Console.Out
33.

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

A. False
B. 0
C. -1
D. All of the mentioned
Answer» D. All of the mentioned
34.

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

A. String
B. Char
C. Integer
D. Boolean
Answer» D. Boolean
35.

Select the correct methodS provided by Console.In?

A. Read(), ReadLine()
B. ReadKey(), ReadLine()
C. Read(), ReadLine(), ReadKey()
D. ReadKey(), ReadLine()
Answer» D. ReadKey(), ReadLine()
36.

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» C. 2
37.

Which of the given stream methods provide the access to the input console in C#.NET?

A. Console.Out
B. Console.Error
C. Console.In
D. All of the mentioned
Answer» D. All of the mentioned
38.

Which of the given stream methods provide access to the output console by default in C#.NET?

A. Console.In
B. Console.Out
C. Console.Error
D. All of the mentioned
Answer» C. Console.Error
39.

Which of the classes provide the operation of reading from and writing to the console in C#.NET?

A. System.Array
B. System.Output
C. System.ReadLine
D. System.Console
Answer» E.
40.

Attributes could be applied to

A. Method
B. Class
C. Assembly
D. All of the mentioned
Answer» E.
41.

Which of the following is the correct statement about inspecting an attribute in C#.NET?

A. An attribute can be inspected at link time
B. An attribute can be inspected at design time
C. An attribute can be inspected at run time
D. None of the mentioned
Answer» B. An attribute can be inspected at design time
42.

Select the correct statement about Attributes used in C#.NET?

A. The CLR can change the behaviour of the code depending on attributes applied to it
B. If a bugFixAttribute is to receive three parameters, then the BugFixAttribute class should implement a zero argument constructor
C. To create a custom attribute we need to create a custom attribute structure and derive it from System.Attribute
D. None of the mentioned
Answer» B. If a bugFixAttribute is to receive three parameters, then the BugFixAttribute class should implement a zero argument constructor
43.

Which among the following cannot be a target for a custom attribute?

A. Enum
B. Event
C. Interface
D. Namespace
Answer» E.
44.

The correct method to pass parameter to an attribute is?

A. By name
B. By address
C. By value
D. By reference
Answer» B. By address
45.

To apply an attribute to an Assembly, the correct way of implementation is?

A. [AssemblyInfo: AssemblyDescription (“Csharp”)].
B. [assembly: AssemblyDescription(“Csharp”)].
C. AssemblyDescription(“Csharp”)].
D. (Assembly:AssemblyDescription(“Csharp”)].
Answer» C. AssemblyDescription(“Csharp”)].
46.

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» B. ASP.NET Runtime
47.

Which of the keywords are used for the block to be examined for exceptions?

A. try
B. catch
C. throw
D. check
Answer» B. catch
48.

Choose the statement which is incorrect?

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» E.
49.

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

A. Error
B. Exception
C. Throwable
D. Throw
Answer» D. Throw
50.

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
C. throws
D. catch
Answer» D. catch