.NET

Description

Quiz on .NET, created by Aidos Baktaev on 16/05/2018.
Aidos Baktaev
Quiz by Aidos Baktaev, updated more than 1 year ago More Less
Aidos Baktaev
Created by Aidos Baktaev over 6 years ago
Арман Киалбеков
Copied by Арман Киалбеков over 6 years ago
Aidos Baktaev
Copied by Aidos Baktaev over 6 years ago
619
10

Resource summary

Question 1

Question
Which of the following are value types? (Choose 3)
Answer
  • Decimal
  • String
  • System.Drawing.Point
  • Integer

Question 2

Question
Which is the correct declaration for a nullable integer?
Answer
  • Nullable(int) i = null;
  • Nullable<int> i = null;
  • int i = null;
  • int<Nullable> i = null;

Question 3

Question
Which of the following are reference types? (Choose 2)
Answer
  • Types declared Nullable
  • String
  • Exception
  • All types derived from System.Object

Question 4

Question
What is the correct order for catch clauses when handling different exception types?
Answer
  • Most general to most specific
  • Most likely to occur to least likely to occur
  • Most specific to most general
  • Least likely to occur to most likely to occur

Question 5

Question
The following scenarios, which would be a good reason to use the String- Builder class instead of the String class?
Answer
  • When building a string from shorter strings
  • When working with text data longer than 256 bytes
  • When you want to search and replace the contents of a string
  • When a string is a value type

Question 6

Question
Why should you close and dispose of resources in a finally block instead of a catch block?
Answer
  • It keeps you from having to repeat the operation in each catch.
  • A finally block runs whether or not an exception occurs.
  • The compiler throws an error if resources are not disposed of in the finally block.
  • You cannot dispose of resources in a catch block.

Question 7

Question
You create an application with built-in exception handling. For some types of exceptions, you want to add an event to the Event Log that specifies the line of code that initiated the exception. Which Exception property should you use?
Answer
  • Message
  • StackTrace
  • Source
  • Data

Question 8

Question
You pass a value-type variable into a procedure as an argument. The procedure changes the variable; however, when the procedure returns, the variable has not changed. What happened?
Answer
  • The variable was not initialized before it was passed in.
  • Passing a value type into a procedure creates a copy of the data.
  • The variable was redeclared within the procedure level.
  • The procedure handled the variable as a reference.

Question 9

Question
Which of the following statements are true? (Choose 2)
Answer
  • Inheritance defines a contract between types.
  • Interfaces define a contract between types.
  • Inheritance derives a type from a base type.
  • Interfaces derive a type from a base type.

Question 10

Question
Which of the following are examples of built-in generic types? (Choose 2)
Answer
  • Nullable
  • Boolean
  • EventHandler
  • System.Drawing.Point

Question 11

Question
You create a generic class in which you store field members whose type is generic. What do you do to dispose of the objects stored in the fields?
Answer
  • Call the Object.Dispose method.
  • Implement the IDisposable interface.
  • Derive the generic class from the IDisposable class.
  • Use constraints to require the generic type to implement the IDisposable interface.

Question 12

Question
You’ve implemented an event delegate from a class, but when you try to attach an event procedure you get a compiler error that there is no overload that matches the delegate. What happened?
Answer
  • The signature of the event procedure doesn’t match that defined by the delegate.
  • The event procedure is declared Shared/static, but it should be an instance member instead.
  • You mistyped the event procedure name when attaching it to the delegate.
  • The class was created in a different language.

Question 13

Question
You are creating a class that needs to be sorted when in a collection. Which interface should you implement?
Answer
  • IEquatable
  • IFormattable
  • IDisposable
  • IComparable

Question 14

Question
Why should boxing be avoided?
Answer
  • It adds overhead.
  • Users must have administrative privileges to run the application.
  • It makes code less readable.

Question 15

Question
Structures inherit ToString from System.Object. Why would someone override that method within a structure? (Choose 2)
Answer
  • To avoid boxing
  • To return something other than the type name
  • The compiler requires structures to override the ToString method
  • To avoid run-time errors caused by invalid string conversions

Question 16

Question
If there is no valid conversion between two types, what should you do when implementing the IConvertible interface?
Answer
  • Delete the ToType member that performs the conversion.
  • Throw an InvalidCastException.
  • Throw a new custom exception reporting the error.
  • Leave the member body empty.

Question 17

Question
With strict conversions enabled, which of the following would allow an implicit conversion? (Choose 2)
Answer
  • Int16 to Int32
  • Int32 to Int16
  • Int16 to double
  • A double to Int16

Question 18

Question
You need to retrieve a list of subdirectories. Which class should you use?
Answer
  • FileInfo
  • DriveInfo
  • FileSystemWatcher
  • DirectoryInfo

Question 19

Question
Which of the following types of changes CANNOT be detected by an instance of FileSystemWatcher?
Answer
  • Which of the following types of changes CANNOT be detected by an instance of FileSystemWatcher?
  • A USB flash drive connected to the computer
  • A directory added to the root of the C:\ drive
  • A file that is renamed

Question 20

Question
You want to copy an existing file, File1.txt, to File2.txt. Which code samples do this correctly? (Choose two. Each answer forms a complete solution.)
Answer
  • File fi = new File(); fi.Copy("file1.txt", "file2.txt");
  • File.Copy("file1.txt", "file2.txt");
  • FileInfo fi = new FileInfo("file1.txt"); fi.CreateText(); fi.CopyTo("file2.txt");
  • FileInfo fi = new FileInfo("file1.txt"); fi.C1opyTo("file2.txt");

Question 21

Question
You want to create a stream that you can use to store a file temporarily while your application processes data. After all data processing is complete, you want to write it to the file system. It’s important that you minimize the time that the file is locked. Which class should you use?
Answer
  • MemoryStream
  • BufferedStream
  • GZipStream
  • FileStream

Question 22

Question
You want to read a standard text file and process the data as strings. Which classes can you use? (Choose two. Each answer forms a complete solution.)
Answer
  • GZipStream
  • TextReader
  • StreamReader
  • BinaryReader

Question 23

Question
You need to store data to isolated storage in such a way that other applications that are run by the same user and other users running the same application cannot access the data directly. Which method should you call to create the IsolatedStorageFile object?
Answer
  • IsolatedStorageFile.GetUserStoreForAssembly()
  • IsolatedStorageFile.GetMachineStoreForAssembly()
  • IsolatedStorageFile.GetUserStoreForDomain()
  • IsolatedStorageFile.GetMachineStoreForDomain()

Question 24

Question
You are writing an application to update absolute hyperlinks in HTML files. You have loaded the HTML file into a string named s. Which of the following code samples best replaces http:// with https://, regardless of whether the user types the URL in uppercase or lowercase?
Answer
  • s = Regex.Replace(s, "http://", "https://");
  • s = Regex.Replace(s, "https://", "http://");
  • s = Regex.Replace(s, "http://", "https://", RegexOptions.IgnoreCase);
  • s = Regex.Replace(s, "https://", "http://", RegexOptions.IgnoreCase);

Question 25

Question
You are writing an application to process data contained in a text form. Each file contains information about a single customer. The following is a sample form:First Name: Tom, Last Name: Perham ,Address: 123 Pine St. City: Springfield State: MA, Zip: 01332 . You have read the form data into the String variable s. Which of the following code samples correctly stores the data portion of the form in the fullName, address, city, state, and zip variables?
Answer
  • string p = @"First Name: (?<firstName>.*$)\n" +@"Last Name: (?<lastName>.*$)\n" +@"Address: (?<address>.*$)\n" +@"City: (?<city>.*$)\n" +@"State: (?<state>.*$)\n" +@"Zip: (?<zip>.*$)";Match m = Regex.Match(s, p, RegexOptions.Multiline);string fullName = m.Groups["firstName"] + " " + m.Groups["lastName"];string address = m.Groups["address"].ToString();string city = m.Groups["city"].ToString();string state = m.Groups["state"].ToString();string zip = m.Groups["zip"].ToString();
  • string p = @"First Name: (?<firstName>.*$)\n" +@"Last Name: (?<lastName>.*$)\n" +@"Address: (?<address>.*$)\n" +@"City: (?<city>.*$)\n" +@"State: (?<state>.*$)\n" +@"Zip: (?<zip>.*$)";Match m = Regex.Match(s, p);string fullName = m.Groups["firstName"] + " " + m.Groups["lastName"];string address = m.Groups["address"].ToString();string city = m.Groups["city"].ToString();string state = m.Groups["state"].ToString();string zip = m.Groups["zip"].ToString();
  • string p = @"First Name: (?<firstName>.*$)\n" +@"Last Name: (?<lastName>.*$)\n" +@"Address: (?<address>.*$)\n" +@"City: (?<city>.*$)\n" +@"State: (?<state>.*$)\n" +@"Zip: (?<zip>.*$)";Match m = Regex.Match(s, p, RegexOptions.Multiline);string fullName = m.Groups["<firstName>"] + " " + m.Groups["<lastName>"];string address = m.Groups["<address>"].ToString();string city = m.Groups["<city>"].ToString(); string state = m.Groups["<state>"].ToString();string zip = m.Groups["<zip>"].ToString();
  • string p = @"First Name: (?<firstName>.*$)\n" +@"Last Name: (?<lastName>.*$)\n" +@"Address: (?<address>.*$)\n" +@"City: (?<city>.*$)\n" +@"State: (?<state>.*$)\n" +@"Zip: (?<zip>.*$)";Match m = Regex.Match(s, p);string fullName = m.Groups["<firstName>"] + " " + m.Groups["<lastName>"];string address = m.Groups["<address>"].ToString();string city = m.Groups["<city>"].ToString(); string state = m.Groups["<state>"].ToString();string zip = m.Groups["<zip>"].ToString();

Question 26

Question
Which of the following regular expressions matches the strings zoot and zot?
Answer
  • z(oo)+t
  • zo*t$
  • $zo*t
  • ^(zo)+t

Question 27

Question
Which of the following strings match the regular expression ^a(mo)+t.*z$? (Choose 3)
Answer
  • amotz
  • amomtrewz
  • amotmoz
  • atrewz
  • amomomottothez

Question 28

Question
Which of the following encoding types would yield the largest file size?
Answer
  • UTF-32
  • UTF-16
  • UTF-8
  • ASCII

Question 29

Question
Which of the following encoding types support Chinese? (Choose 3)
Answer
  • UTF-32
  • UTF-16
  • UTF-8
  • ASCII

Question 30

Question
You need to decode a file encoded in ASCII. Which of the following decoding types would yield correct results? (Choose 2)
Answer
  • Encoding.UTF32
  • Encoding.UTF16
  • Encoding.UTF8
  • Encoding.UTF7

Question 31

Question
You are writing an application that generates summary reports nightly. These reports will be viewed by executives in your Korea office and must contain Korean characters. Which of the following encoding types is the best one to use?
Answer
  • iso-2022-kr
  • x-EBCDIC-KoreanExtended
  • x-mac-korean
  • UTF-16

Question 32

Question
You create an instance of the Stack class. After adding several integers to it, you need to remove all objects from the Stack. Which method should you call?
Answer
  • Stack.Pop
  • Stack.Push
  • Stack.Clear
  • Stack.Peek

Question 33

Question
You need to create a collection to act as a shopping cart. The collection will store multiple instances of your custom class, ShoppingCartItem. You need to be able to sort the items according to price and time added to the shopping cart (both properties of the ShoppingCartItem). Which class should you use for the shopping cart?
Answer
  • Queue
  • ArrayList
  • Stack
  • StringCollection

Question 34

Question
You create an ArrayList object and add 200 instances of your custom class,Product. When you call ArrayList.Sort, you receive an InvalidOperationException.How should you resolve the problem? (Choose two. Each answer forms part of the complete solution.)
Answer
  • Implement the IComparable interface.
  • Create a method named CompareTo.
  • Implement the IEnumerable interface.
  • Create a method named GetEnumerator.

Question 35

Question
You are creating a collection that will act as a database transaction log. You need to be able to add instances of your custom class, DBTransaction, to the collection.If an error occurs, you need to be able to access the most recently added instance of DBTransaction and remove it from the collection. The collection must be strongly typed. Which class should you use?
Answer
  • HashTable
  • SortedList
  • Stack
  • Queue

Question 36

Question
You are creating a custom dictionnary class. You want it to be type-safe, using a string for a key and your custom class Product as the value. Which class declaration meets your requirements?
Answer
  • public class Products2 : StringDictionary{ }
  • class Products : Dictionary<string, Product>{ }
  • class Products : StringDictionary<string, Product>{ }
  • .class Products : Dictionary{ }

Question 37

Question
You create an instance of the SortedList collection, as shown here: SortedList<Product, string> sl = new SortedList<Product, string>(); Which declaration of the Product class works correctly?
Answer
  • public class Product : IComparable { public string productName; public Product(string _productName) {this.productName = _productName; } public int CompareTo(object obj) {Product otherProduct = (Product)obj; return his.productName.CompareTo(otherProduct.productName); } }
  • public class Product{ public string productName; public Product(string _productName) { this.productName = _productName;}public int CompareTo(object obj){Product otherProduct = (Product)obj; return this.productName.CompareTo(otherProduct.productName);}}
  • public class Product : IEquatable { public string productName; public Product(string _productName) { this.productName = _productName; } public int Equals(object obj) {Product otherProduct = (Product)obj; return this.productName.Equals(otherProduct.productName);}}
  • public class Product {public string productName; public Product(string _productName) {this.productName = _productName;} public int Equals(object obj){Product otherProduct = (Product)obj;return this.productName.Equals(otherProduct.productName);}}

Question 38

Question
Which of the following are required to serialize an object? (Choose 2)
Answer
  • An instance of BinaryFormatter or SoapFormatter File
  • permissions to create temporary files Microsoft Internet
  • Information Services (IIS)
  • A stream object

Question 39

Question
Which of the following attributes should you add to a class to enable it to be serialized?
Answer
  • ISerializable
  • Serializable
  • SoapInclude
  • OnDeserialization

Question 40

Question
Which of the following attributes should you add to a member to prevent it from being serialized by BinaryFormatter?
Answer
  • NonSerialized
  • Serializable
  • SerializationException
  • SoapIgnore

Question 41

Question
Which of the following interfaces should you implement to enable you to run a method after an instance of your class is deserialized?
Answer
  • IFormatter
  • ISerializable
  • IDeserializationCallback
  • IObjectReference

Question 42

Question
Which of the following are requirements for a class to be serialized with XML serialization? (Choose 2)
Answer
  • The class must be public.
  • The class must have a constructor that accepts a SerializationInfo parameter.
  • The class must be private.
  • The class must have a parameterless constructor.

Question 43

Question
Which of the following attributes would you use to cause a member to be serialized as an XML attribute, rather than as an XML element?
Answer
  • XmlType
  • XmlAttribute
  • XmlElement
  • XmlAnyAttribute

Question 44

Question
Which tool would you use to help you create a class that, when serialized, would produce an XML document that conformed to an XML schema?
Answer
  • Xsd.exe
  • Xcacls.exe
  • XPadsi90.exe
  • Xdcmake.exe

Question 45

Question
Which of the following attributes should you add to a member to prevent it from being serialized by XML serialization?
Answer
  • XmlAttribute
  • XmlElement
  • XmlIgnore
  • XmlType

Question 46

Question
Which parameters must a constructor accept if the class implements ISerializable? (Choose 2)
Answer
  • ObjectManager
  • StreamingContext
  • Formatter
  • SerializationInfo

Question 47

Question
Which event would you use to run a method immediately before deserialization occurs?
Answer
  • OnDeserialized
  • OnSerialized
  • OnDeserializing
  • OnSerializing

Question 48

Question
Which of the following are requirements for a method that is called in response to a serialization event? (Choose 2)
Answer
  • Return a StreamingContext object.
  • Return void.
  • Accept a SerializationInfo object as a parameter.
  • Accept a StreamingContext object as a parameter.

Question 49

Question
Which of the following methods is the best to use to draw a square with a solidcolor?
Answer
  • Graphics.FillEllipse
  • Graphics.FillPolygon
  • Graphics.FillRectangle
  • Graphics.DrawEllipse
  • Graphics.DrawPolygon
  • Graphics.DrawRectangle
  • Graphics.DrawLines

Question 50

Question
Which of the following methods is the best to use to draw an empty triangle?
Answer
  • Graphics.FillEllipse
  • Graphics.FillPolygon
  • Graphics.FillRectangle
  • Graphics.DrawEllipse
  • Graphics.DrawPolygon
  • Graphics.DrawRectangle
  • Graphics.DrawLines

Question 51

Question
Which of the following classes is required to draw an empty circle? (Choose 2)
Answer
  • System.Drawing.Bitma
  • System.Drawing.Brush
  • System.Drawing.Pen
  • System.Drawing.Graphics

Question 52

Question
Which of the following brush classes is the best to use to create a solid rectangle that is red at the top and gradually fades to white towards the bottom?
Answer
  • System.Drawing.TextureBrush
  • System.Drawing.SolidBrush
  • System.Drawing.Drawing2D.LinearGradientBrush
  • System.Drawing.Drawing2D.PathGradientBrush
  • System.Drawing.Drawing2D.HatchBrush

Question 53

Question
What type of line would the following code sample draw? // C#Graphics g = this.CreateGraphics(); Pen p = new Pen(Color.Red, 10); p.StartCap = LineCap.Flat; p.EndCap = LineCap.ArrowAnchor; g.DrawLine(p, 50, 50, 400, 50);
Answer
  • An arrow pointing up
  • An arrow pointing down
  • An arrow pointing left
  • An arrow pointing right

Question 54

Question
Which of the following classes could you use to display a JPEG image from an existing file in a form? (Choose 2)
Answer
  • System.Windows.Forms.PictureBox
  • System.Drawing.Imaging.Metafile
  • System.Drawing.Bitmap
  • System.Drawing.Image

Question 55

Question
How can you draw a black border around a JPEG image that you have saved to disk and then save the updated image back to the disk?
Answer
  • Create a Graphics object by loading the JPEG image from the disk. Draw the border by calling Graphics.DrawRectangle. Finally, save the updated image by calling Graphics.Save.
  • Create a Bitmap object by loading the JPEG image from the disk. Draw the border by calling Bitmap.DrawRectangle. Finally, save the updated image by calling Bitmap.Save.
  • Create a Bitmap object by loading the JPEG image from the disk. Create a Graphics object by calling Graphics.FromImage. Draw the border by calling Graphics.DrawRectangle. Finally, save the updated image by calling Bitmap .Save.
  • Create a Bitmap object by loading the JPEG image from the disk. Create a Graphics object by calling Bitmap.CreateGraphics. Draw the border by calling Graphics.DrawRectangle. Finally, save the updated image by calling Bitmap .Save.

Question 56

Question
Which format is the best choice to use if you want to save a photograph that could be opened by a wide variety of applications?
Answer
  • ImageFormat.Png
  • ImageFormat.Jpeg
  • ImageFormat.Gif
  • ImageFormat.Bmp

Question 57

Question
Which format is the best choice to use if you want to save a pie chart that could be opened by a wide variety of applications?
Answer
  • ImageFormat.Png
  • ImageFormat.Jpeg
  • ImageFormat.Bmp
  • ImageFormat.Gif

Question 58

Question
What are the steps for adding text to an image?
Answer
  • Create a Bitmap object, a Font object, and a Brush object. Then call Bitmap.DrawString.
  • Create a Graphics object, a Font object, and a Pen object. Then call Graphics.DrawString.
  • Create a Graphics object, a Font object, and a Brush object. Then call Graphics.DrawString.
  • Create a Graphics object and a string object. Then call string.Draw.

Question 59

Question
Which class would you need to create an instance of to specify that a string should be centered when drawn?
Answer
  • LineAlignment
  • FormatFlags
  • StringAlignment
  • StringFormat

Question 60

Question
Which of the following commands would cause a string to be flush left?
Answer
  • StringFormat.Alignment = Far
  • StringFormat.Alignment = Near
  • StringFormat.LineAlignment = Far
  • StringFormat.LineAlignment = Near

Question 61

Question
You are developing an application that will add text to JPEG, PNG, and GIF image files. Which class should you use to allow you to edit any of those image formats?
Answer
  • Image
  • Bitmap
  • Icon
  • Metafile

Question 62

Question
Which of the following statements are TRUE about the .NET CLR? (Choose 4)
Answer
  • It provides services to run "unmanaged" applications.
  • The resources are garbage collected.
  • It ensures that an application would not be able to access memory that it is not authorized to access.
  • It provides services to run "managed" applications.
  • It provides a language-neutral development & execution environment.

Question 63

Question
Which of the following are valid .NET CLR JIT performance counters? (Choose 2)
Answer
  • Percentage of memory currently dedicated for JIT compilation
  • Percentage of processor time spent performing JIT compilation
  • Number of methods that failed to compile with the standard JIT
  • Average memory used for JIT compilation
  • Total memory used for JIT compilation

Question 64

Question
Which of the following statements is correct about Managed Code?
Answer
  • Managed code is the code that can run on top of Linux.
  • Managed code is the code that is written to target the services of the CLR.
  • Managed code is the code that runs on top of Windows.
  • Managed code is the code where resources are Garbage Collected.
  • Managed code is the code that is compiled by the JIT compilers.

Question 65

Question
Which of the following are NOT true about .NET Framework? (Choose 2)
Answer
  • It provides an event driven programming model for building Windows Device Drivers.
  • It provides different programming models for Windows-based applications and Web- based applications.
  • It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party.
  • It provides a code-execution environment that minimizes software deployment and versioning conflicts.
  • It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.

Question 66

Question
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?
Answer
  • Component Object Model
  • Common Type System
  • .NET class libraries
  • Common Language Infrastructure
  • Common Language Runtime

Question 67

Question
Which of the following jobs are NOT performed by Garbage Collector? (Choose 3)
Answer
  • Closing unclosed files.
  • Closing unclosed database collections.
  • Freeing memory occupied by unreferenced objects.
  • Avoiding memory leaks.
  • Freeing memory on the stack.

Question 68

Question
Which of the following .NET components can be used to remove unused references from the managed heap?
Answer
  • CTS
  • Class Loader
  • Garbage Collector
  • CLR
  • Common Language Infrastructure

Question 69

Question
Which of the following statements correctly define .NET Framework?
Answer
  • It is an environment for development and execution of Windows applications.
  • It is an environment for developing, building, deploying and executing Web Services.
  • It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.
  • It is an environment for developing, building, deploying and executing Distributed Applications.
  • It is an environment for developing, building, deploying and executing only Web Applications.

Question 70

Question
Which of the following constitutes the .NET Framework? (Choose 2)
Answer
  • Windows Services
  • WinForm Applications
  • Framework Class Library
  • CLR
  • ASP.NET Applications

Question 71

Question
Which of the following assemblies can be stored in Global Assembly Cache?
Answer
  • Protected Assemblies
  • Public Assemblies
  • Friend Assemblies
  • Shared Assemblies
  • Private Assemblies

Question 72

Question
Code that targets the Common Language Runtime is known as
Answer
  • Native Code
  • Managed Code
  • Legacy
  • Distributed
  • Unmanaged

Question 73

Question
Which of the following statements is correct about the .NET Framework?
Answer
  • .NET Framework uses COM+ services while creating Distributed Applications.
  • .NET Framework uses DCOM for creating unmanaged applications.
  • .NET Framework uses DCOM for making transition between managed and unmanaged code.
  • .NET Framework is built on the DCOM technology.
  • .NET Framework uses DCOM for achieving language interoperability.

Question 74

Question
Which of the following is the root of the .NET type hierarchy?
Answer
  • System.Root
  • System.Parent
  • System.Base
  • System.Type
  • System.Object

Question 75

Question
Which of the following benefits do we get on running managed code under CLR? (Choose 4)
Answer
  • Type safety of the code running under CLR is assured.
  • It is ensured that an application would not access the memory that it is not authorized to access.
  • It launches separate process for every application running under it.
  • The resources are Garbage collected.
  • TUT KOROCHE VSE RIGHT

Question 76

Question
Which of the following statements are correct about JIT? (Choose 3)
Answer
  • JIT compiler compiles instructions into machine code at run time.
  • The code compiler by the JIT compiler runs under CLR.
  • The instructions compiled by JIT compilers are written in native code.
  • The instructions compiled by JIT compilers are written in Intermediate Language (IL) code.
  • The method is JIT compiled even if it is not called

Question 77

Question
Which of the following are parts of the .NET Framework? (Choose 2)
Answer
  • The Common Language Runtime (CLR)
  • The Framework Class Libraries (FCL)
  • Microsoft Published Web Services
  • Applications deployed on IIS
  • Mobile Applications

Question 78

Question
Which one of the following classes are present System.Collections.Generic namespace? (Choose 2)
Answer
  • SortedArray
  • SortedDictionary
  • Tree
  • Stack

Question 79

Question
For the code snippet shown below, which of the following statements are valid? public class Generic<T>{ public T Field; public void TestSub() { T i = Field + 1; } } class MyProgram { static void Main(string[] args) { Generic<int> gen = new Generic<int>(); gen.TestSub(); } }
Answer
  • None of the above.
  • Compiler will report an error: Operator '+' is not defined for types T and int.
  • Program will generate run-time exception.
  • Result of addition is system-dependent.
  • Addition will produce result 1.

Question 80

Question
Which of the following statements are valid about generics in .NET Framework? (Choose 2)
Answer
  • Generics is a language feature.
  • We can create a generic class, however, we cannot create a generic interface in C#.NET.
  • Generics delegates are not allowed in C#.NET.
  • Generics are useful in collection classes in .NET framework
  • None of All

Question 81

Question
Which of the following statements is valid about generic procedures in C#.NET?
Answer
  • None of All.
  • Generic procedures must take at least one type parameter.
  • Generic procedures can take at the most one generic parameter.
  • Only those procedures labeled as Generic are generic.
  • All procedures in a Generic class are generic.

Question 82

Question
For the code snippet shown below, which of the following statements are valid? public class TestIndiaBix { public void TestSub<M> (M arg) { Console.Write(arg); }} class MyProgram { static void Main(string[] args) { TestIndiaBix bix = new TestIndiaBix(); bix.TestSub("Hello world "); bix.TestSub(4.2f); }}
Answer
  • None of all.
  • Program will generate a run-time exception.
  • Compiler will generate an error.
  • A non generic class Hello cannot have generic subroutine.
  • Program will compile and on execution will print: Hello world

Question 83

Question
For the code snippet given below, which of the following statements is valid? public class Generic<T> { public T Field;} class Program { static void Main(string[ ] args) { Generic<String> g = new Generic<String>(); g.Field = "Hello"; Console.WriteLine(g.Field); }}
Answer
  • None of the above.
  • Member Field of class Generic is not accessible directly.
  • Compiler will give an error.
  • Name Generic cannot be used as a class name because it's a keyword.
  • It will print string "Hello" on the console.

Question 84

Question
For the code snippet given below, which of the following statements are valid? public class MyContainer<T> where T: IComparabte { // Insert code here } (Choose 2)
Answer
  • This requirement on type argument is called as constraint
  • Compiler will report an error for this block of code.
  • Type argument of class MyContainer must be IComparabte.
  • Class MyContainer requires that it's type argument must implement IComparable interface.

Question 85

Question
For the code snippet given below, which of the following statements are valid? public class MyContainer<T> where T: class, IComparable { //Insert code here} (Choose 2)
Answer
  • Class MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.
  • There are multiple constraints on type argument to MyContainer class.
  • Compiler will report an error for this block of code.
  • Class MyContainer requires that it's type argument must implement IComparable interface.

Question 86

Question
Which of the following statements is valid about advantages of generics?
Answer
  • None of the above.
  • Generics eliminate the possibility of run-time errors.
  • Generics provide type safety without the overhead of multiple implementations.
  • Generics require use of explicit type casting.
  • Generics shift the burden of type safety to the programmer rather than compiler.

Question 87

Question
Which of the following statements is correct about the C#.NET code snippet given below? interface IMyInterface { void fun1(); int fun2(); } class MyClass: IMyInterface { void fun1() { } int IMyInterface.fun2() { } }
Answer
  • MyClass is an abstract class.
  • A Method Table will not be created for class MyClass.
  • A subroutine cannot be declared inside an interface.
  • A function cannot be declared inside an interface.
  • The definition of fun1() in class MyClass should be void IMyInterface.fun1().

Question 88

Question
Which of the following can be declared in an interface? (Choose 3)
Answer
  • Methods
  • Properties
  • Enumerations
  • Events
  • Structures

Question 89

Question
Which of the following statements is correct about an interface used in C#.NET?
Answer
  • Interfaces cannot be inherited.
  • Properties can be declared inside an interface.
  • From two base interfaces a new interface cannot be inherited.
  • In a program if one class implements an interface then no other class in the same program can implement this interface.
  • One class can implement only one interface.

Question 90

Question
Which of the following statements is correct about Interfaces used in C#.NET?
Answer
  • Interfaces can contain static data and methods.
  • Interfaces can contain only method declaration.
  • All interfaces are derived from an Object interface.
  • Interfaces can be inherited.
  • All interfaces are derived from an Object class.

Question 91

Question
Which of the following statements is correct about an interface used in C#.NET?
Answer
  • If a class implements an interface partially, then it should be an abstract class.
  • A class cannot implement an interface partially.
  • An interface can contain static methods.
  • An interface can contain static data.
  • Multiple interface inheritance is not allowed.

Question 92

Question
Which of the following statements is correct about an interface?
Answer
  • One interface can be implemented in another interface.
  • An interface can be implemented by multiple classes in the same program.
  • A class that implements an interface can explicitly implement members of that interface.
  • The functions declared in an interface have a body.

Question 93

Question
Which of the following statements are correct about an interface in C#.NET? (Choose 3)
Answer
  • A class can implement multiple interfaces.
  • Structures cannot inherit a class but can implement an interface.
  • In C#.NET, : is used to signify that a class member implements a specific interface.
  • An interface can implement multiple classes.
  • The static attribute can be used with a method that implements an interface declaration.

Question 94

Question
Which of the following is the correct implementation of the interface given below? interface IMyInterface { double MyFun(Single i); }
Answer
  • class MyClass { double MyFun(Single i) as IMyInterface.MyFun { // Some code }}
  • class MyClass { MyFun (Single i) As Double {// Some code } }
  • class MyClass: implements IMyInterface { double fun(Single si) implements IMyInterface.MyFun() { //Some code } }
  • class MyClass: IMyInterface { double IMyInterface.MyFun(Single i) { // Some code } }

Question 95

Question
Which of the following statements is correct?
Answer
  • When a class inherits an interface it inherits member definitions as well as its implementations.
  • An interface cannot contain the signature of an indexer.
  • Interfaces members are automatically public.
  • To implement an interface member, the corresponding member in the class must be public as well as static.

Question 96

Question
Which of the following statements are correct about an interface used in C#.NET? (Choose 3)
Answer
  • An interface can contain properties, methods and events.
  • The keyword must implement forces implementation of an interface.
  • Interfaces can be overloaded.
  • Interfaces can be implemented by a class or a struct.
  • Enhanced implementations of an interface can be developed without breaking existing code.

Question 97

Question
Which of the following can implement an interface? (Choose 2)
Answer
  • Data
  • Class
  • Enum
  • Structure
  • Namespace

Question 98

Question
Which of the following statements is correct about the C#.NET code snippet given below? interface IMyInterface{ void fun1(); void fun2(); } class MyClass: IMyInterface { private int i; void IMyInterface.fun1() { // Some code } }
Answer
  • Class MyClass is an abstract class.
  • Class MyClass cannot contain instance data.
  • Class MyClass fully implements the interface IMyInterface.
  • Interface IMyInterface should be inherited from the Object class.
  • The compiler will report an error since the interface IMyInterface is only partially implemented.

Question 99

Question
Which of the following statements is correct about the C#.NET code snippet given below? interface IPerson{ String FirstName { get; set; } String LastName { get; set; } void Print(); void Stock(); int Fun(); }
Answer
  • Properties cannot be declared inside an interface.
  • This is a perfectly workable interface.
  • The properties in the interface must have a body.
  • Subroutine in the interface must have a body.
  • Functions cannot be declared inside an interface.

Question 100

Question
Which of the following is the correct way to implement the interface given below?interface IPerson { String FirstName { get; set; } }
Answer
  • class Employee : IPerson{ private String str; public String FirstName { get { return str; } set { str = value; } } }
  • class Employee{ private String str; public String IPerson.FirstName { get { return str; } set { str = value; } } }
  • class Employee : implements IPerson{ private String str; public String FirstName { get { return str; } set { str = value; } } }
  • None of the above

Question 101

Question
Which of the following can be facilitated by the Inheritance mechanism? (Choose 3)
Answer
  • Use the existing functionality of base class.
  • Overrride the existing functionality of base class.
  • Implement new functionality in the derived class.
  • Implement polymorphic behaviour.
  • Implement containership.

Question 102

Question
Which of the following statements should be added to the subroutine fun( ) if the C#.NET code snippet given below is to output 9 13? class BaseClass { protected int i = 13;} class Derived: BaseClass { int i = 9; public void fun() { // [*** Add statement here ***] } }
Answer
  • Console.WriteLine(base.i + " " + i);
  • Console.WriteLine(i + " " + base.i);
  • Console.WriteLine(mybase.i + " " + i);
  • Console.WriteLine(i + " " + mybase.i);
  • Console.WriteLine(i + " " + this.i);

Question 103

Question
Which of the following statements are correct about the C#.NET code snippet given below? namespace ConsoleApplication{ class index { protected int count; public index() { count = 0; } } class index1: index { public void increment() { count = count +1; } } class MyProgram { static void Main(string[] args) { index1 i = new index1(); i.increment(); } }} (Choose 3)
Answer
  • count should be declared as public if it is to become available in the inheritance chain.
  • count should be declared as protected if it is to become available in the inheritance chain.
  • While constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class.
  • Constructor of index class does not get inherited in index1 class.
  • count should be declared as Friend if it is to become available in the inheritance chain.

Question 104

Question
What will be the size of the object created by the following C#.NET code snippet? namespace IndiabixConsoleApplication{ class Baseclass { private int i; protected int j; public int k; } class Derived: Baseclass { private int x; protected int y; public int z; } class MyProgram { static void Main (string[ ] args) { Derived d = new Derived(); } }}
Answer
  • 24 bytes
  • 12 bytes
  • 20 bytes
  • 10 bytes
  • 16 bytes

Question 105

Question
Which statement will you add in the function fun() of class B, if it is to produce the output "Welcome to Microsoft.com!"? namespace IndiabixConsoleApplication{ class A { public void fun() { Console.Write("Welcome"); } } class B: A { public void fun() { // [*** Add statement here ***] Console.WriteLine(" to Microsoft.com!"); } } class MyProgram { static void Main (string[ ] args) { B b = new B(); b.fun(); } } }
Answer
  • A.fun();
  • mybase.fun();
  • A::fun();
  • fun();
  • base.fun();

Question 106

Question
Which of the following should be used to implement a 'Has a' relationship between two entities?
Answer
  • Polymorphism
  • Templates
  • Containership
  • Encapsulation
  • Inheritance

Question 107

Question
Which of the following is correct about the C#.NET snippet given below? namespace IndiabixConsoleApplication { class Baseclass { public void fun() { Console.WriteLine("Hi" + " "); } public void fun(int i) { Console.Write("Hello" + " "); } } class Derived: Baseclass { public void fun() { Console.Write("Bye" + " "); } } class MyProgram { static void Main(string[ ] args) { Derived d; d = new Derived(); d.fun(); d.fun(77); } } }
Answer
  • The program gives the output as: Hi Hello Bye
  • The program gives the output as: Bye Hello
  • The program gives the output as: Hi Bye Hello
  • Error in the program

Question 108

Question
In an inheritance chain which of the following members of base class are accessible to the derived class members? (Choose 2)
Answer
  • static
  • protected
  • private
  • shared
  • public

Question 109

Question
Which of the following are reuse mechanisms available in C#.NET? (Choose 2)
Answer
  • Inheritance
  • Encapsulation
  • Templates
  • Containership
  • Polymorphism

Question 110

Question
Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?
Answer
  • Polymorphism
  • Containership
  • Templates
  • Encapsulation
  • Inheritance

Question 111

Question
How can you prevent inheritance from a class in C#.NET ?
Answer
  • Declare the class as shadows.
  • Declare the class as overloads.
  • Declare the class as sealed.
  • Declare the class as suppress.
  • Declare the class as override.

Question 112

Question
Which of the following statements are correct about Inheritance in C#.NET? (Choose 3)
Answer
  • Inheritance cannot suppress the base class functionality.
  • A derived class object contains all the base class data.
  • A derived class may not be able to access all the base class data.
  • Inheritance cannot extend the base class functionality.
  • In inheritance chain construction of object happens from base towards derived.

Question 113

Question
Assume class B is inherited from class A. Which of the following statements is correct about construction of an object of class B?
Answer
  • While creating the object firstly the constructor of class B will be called followed by constructor of class A.
  • While creating the object firstly the constructor of class A will be called followed by constructor of class B.
  • The constructor of only class B will be called.
  • The constructor of only class A will be called.
  • The order of calling constructors depends upon whether constructors in class Aand class B are private or public.

Question 114

Question
Which of the following statements is correct about the C#.NET program given below? namespace IndiabixConsoleApplication{ class Baseclass { int i; public Baseclass(int ii) { i = ii; Console.Write("Base "); } } class Derived : Baseclass { public Derived(int ii) : base(ii) { Console.Write("Derived "); } } class MyProgram { static void main(string[ ] args) { Derived d = new Derived(10); } } }
Answer
  • The program will work correctly only if we implement zero-argument constructors in Baseclass as well as Derived class.
  • The program will output: Derived Base
  • The program will report an error in the statement base(ii).
  • The program will work correctly if we replace base(ii) withbase.Baseclass(ii).
  • The program will output: Base Derived

Question 115

Question
Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface? (Choose 3)
Answer
  • The ArrayList class contains an inner class that implements the IEnumeratorinterface.
  • An ArrayList Collection cannot be accessed simultaneously by different threads.
  • The inner class of ArrayList can access ArrayList class's members.
  • To access members of ArrayList from the inner class, it is necessary to passArrayList class's reference to it.
  • Enumerator's of ArrayList Collection can manipulate the array.

Question 116

Question
How many enumerators will exist if four threads are simultaneously working on an ArrayList object?
Answer
  • 1
  • 3
  • 2
  • 4
  • Depends upon the Project Setting made in Visual Studio.NET.

Question 117

Question
In which of the following collections is the Input/Output index-based? (choose 2)
Answer
  • Stack
  • Queue
  • BitArray
  • ArrayList
  • HashTable

Question 118

Question
In which of the following collections is the Input/Output based on a key? (choose 2)
Answer
  • Map
  • Stack
  • BitArray
  • HashTable
  • SortedList

Question 119

Question
In a HashTable Key cannot be null, but Value can be.
Answer
  • True
  • False

Question 120

Question
Which of the following statements are correct about the C#.NET code snippet given below? Stack st = new Stack(); st.Push("hello");st.Push(8.2); st.Push(5);st.Push('b');st.Push(true);
Answer
  • Dissimilar elements like "hello", 8.2, 5 cannot be stored in the same Stackcollection.
  • Boolean values can never be stored in Stack collection.
  • In the fourth call to Push(), we should write "b" in place of 'b'.
  • To store dissimilar elements in a Stack collection, a method PushAnyType()should be used in place of Push().
  • This is a perfectly workable code.

Question 121

Question
Which of the following statements are correct about the Stack collection? (choose 3)
Answer
  • It can be used for evaluation of expressions.
  • All elements in the Stack collection can be accessed using an enumerator.
  • It is used to maintain a FIFO list.
  • All elements stored in a Stack collection must be of similar type.
  • Top-most element of the Stack collection can be accessed using the Peek()method.

Question 122

Question
A HashTable t maintains a collection of names of states and capital city of each state. Which of the following is the correct way to find out whether "KKK" state is present in this collection or not?
Answer
  • t.ContainsKey("KKK");
  • t.HasValue("KKK");
  • t.HasKey("KKK");
  • t.ContainsState("KKK");
  • t.ContainsValue("KKK");

Question 123

Question
Which of the following is the correct way to access all elements of the Queue collection created using the C#.NET code snippet given below? Queue q = new Queue(); q.Enqueue("achin"); q.Enqueue('A'); q.Enqueue(false); q.Enqueue(38); q.Enqueue(5.4);
Answer
  • IEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • IEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • IEnumerator e;e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
  • IEnumerator e;e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);

Question 124

Question
Which of the following is NOT an interface declared in System.Collections namespace?
Answer
  • IComparer
  • IEnumerable
  • IEnumerator
  • IDictionaryComparer
  • IDictionaryEnumerator

Question 125

Question
Suppose value of the Capacity property of ArrayList Collection is set to 4. What will be the capacity of the Collection on adding fifth element to it?
Answer
  • 4
  • 8
  • 16
  • 32

Question 126

Question
Which of the following is an ordered collection class? (choose 2)
Answer
  • Map
  • Stack
  • Queue
  • BitArray
  • HashTabe

Question 127

Question
Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
Answer
  • arr.UpperBound
  • arr.Count
  • arr.GrowSize
  • arr.MaxIndex
  • arr.Capacity

Question 128

Question
Which of the following statements are correct about a HashTable collection? (choose 3)
Answer
  • It is a keyed collection.
  • It is a ordered collection.
  • It is an indexed collection.
  • It implements a IDictionaryEnumerator interface in its inner class.
  • The key - value pairs present in a HashTable can be accessed using the Keysand Values properties of the inner class that implements theIDictionaryEnumerator interface.

Question 129

Question
Which of the following is the correct way to access all elements of the Stack collection created using the C#.NET code snippet given below?Stack st = new Stack();st.Push(11);st.Push(22);st.Push(-53);st.Push(33);st.Push(66);
Answer
  • IEnumerable e; e = st.GetEnumerator();while (e.MoveNext())Console.WriteLine(e.Current);
  • IEnumerator e;e = st.GetEnumerable();while (e.MoveNext())Console.WriteLine(e.Current);
  • IEnumerator e; e = st.GetEnumerator();while (e.MoveNext())Console.WriteLine(e.Current);
  • IEnumerator e; e = Stack.GetEnumerator();while (e.MoveNext()) Console.WriteLine(e.Current);

Question 130

Question
Which of the following statements are correct about the Collection Classes available in Framework Class Library?
Answer
  • Elements of a collection cannot be transmitted over a network.
  • Elements stored in a collection can be retrieved but cannot be modified.
  • It is not easy to adopt the existing Collection classes for newtype of objects.
  • Elements stored in a collection can be modified only if allelements are of similar types.
  • They use efficient algorithms to manage the collection, thereby improving the performance of the program.

Question 131

Question
The authorization settings in web.config overlap settings available in IIS. Options
Answer
  • True
  • False

Question 132

Question
What component of a Data Provider provides connected, forward-only, read- only access to a database?
Answer
  • DataAdapter
  • Command object
  • Connection object
  • DataReader object

Question 133

Question
A DataAdapter facilitates disconnected data access.
Answer
  • True
  • False

Question 134

Question
Which of the following refers to providing new culture-specific resources and retrieving the appropriate resource based on the culture setting?
Answer
  • Localization
  • Globalization
  • Overloading
  • Encapsulation

Question 135

Question
Which of the following automatically detects if windows installer is installed on the target machine?
Answer
  • Assembly
  • Native image
  • Bootstrapper application
  • Globalization

Question 136

Question
______is the verification that all callers to code have appropriate permission to access it.
Answer
  • Code tuning
  • Code access security
  • Common language runtime
  • Common type system

Question 137

Question
Which ensures that users of your application have appropriate permission to access your application based on the identity of the user?
Answer
  • Code-access security
  • Role-based security

Question 138

Question
If no access modifier is specified for a class or a structure, it is considered .....
Answer
  • private
  • public
  • internal
  • protected

Question 139

Question
Enumerations must be of a numeric integral type.
Answer
  • True
  • False

Question 140

Question
Which of the following is not correct for delegates?
Answer
  • It provides the functionality behind events.
  • It is a strongly typed function pointer.
  • It can be used to invoke a method without making an explicit call to that method.
  • It can not be used for creation of association between events and event handlers.

Question 141

Question
___is the ability of different objects to expose different implementations of the same public interface.
Answer
  • Encapsulation
  • Overriding
  • Polymorphism
  • Abstraction

Question 142

Question
Returns a result set by way of a DataReader object.
Answer
  • ExecuteNonQuery
  • ExecuteScalar
  • ExecuteReader

Question 143

Question
Which of the following is not true for shared assembly?
Answer
  • It can be accessed by multiple programs at once.
  • It must be installed to the GAC.
  • It can be accessed only by one application.

Question 144

Question
Which type of assembly should be created when you want to provide different sets of resources for different culture?
Answer
  • Private assembly
  • Satellite assembly
  • Shared assembly

Question 145

Question
Inheriting from a base class and providing a new method for one of the base class methods
Answer
  • Overriding
  • Overloading
  • Shadowing
  • Abstracting

Question 146

Question
It contains all the information needed to describe the assembly to the common language runtime.
Answer
  • Bootstrapper
  • Assembly manifest
  • GAC
  • Strong Name

Question 147

Question
You work as a Software Developer for uCertify Inc. The company uses Visual Studio .NET as its application development platform. You are creating an application that uses isolated storage to store user preferences using the .NET Framework. You use several assemblies for different purpose in the application. The application will be used by multiple users on the same computer. You are required to create a directory named MyPrefer in the isolated storage area that is scoped to the current Microsoft Windows identity and assembly. Which of the following code segments will you use to accomplish the task?
Answer
  • IsolatedStorageFile store;store = IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory("MyPrefer");
  • IsolatedStorageFile store;store = IsolatedStorageFile.GetUserStoreForApplication();store.CreateDirectory("MyPrefer");
  • IsolatedStorageFile store;store = IsolatedStorageFile.GetUserStoreForAssembly();store.CreateDirectory("MyPrefer");
  • IsolatedStorageFile store;store = IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory("MyPrefer");

Question 148

Question
ОТВЕТ НЕ ТОЧЕН Which of the following are the correct ways to increment the value of variable a by 1? (choose 2)
Answer
  • ++a++;
  • a += 1;
  • a ++ 1;
  • a = a +1;
  • a = +1;

Question 149

Question
What will be the output of the C#.NET code snippet given below?
Answer
  • 163 92
  • 92 163
  • 192 63
  • 0 1

Question 150

Question
Which of the following is NOT an Arithmetic operator in C#.NET?
Answer
  • **
  • +
  • /
  • %
  • *

Question 151

Question
Which of the following is NOT a Bitwise operator in C#.NET?
Answer
  • &
  • |
  • <<
  • ^
  • ~

Question 152

Question
Which of the following statements is correct about the C#.NET code snippet given below? int d; d = Convert.ToInt32( !(30 < 20) );
Answer
  • A value 0 will be assigned to d.
  • A value 1 will be assigned to d.
  • A value -1 will be assigned to d.
  • The code reports an error.
  • The code snippet will work correctly if ! is replaced by Not.

Question 153

Question
Which of the following are NOT Relational operators in C#.NET?
Answer
  • >=
  • !=
  • Not
  • <=
  • <>=

Question 154

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

Question 155

Question
Which of the following statements are correct about the Bitwise & operator used in C#.NET? (choose 3)
Answer
  • The & operator can be used to Invert a bit.
  • The & operator can be used to put ON a bit.
  • The & operator can be used to put OFF a bit.
  • The & operator can be used to check whether a bit is ON.
  • The & operator can be used to check whether a bit is OFF.

Question 156

Question
Which of the following are Logical operators in C#.NET? (choose 3)
Answer
  • &&
  • ||
  • !
  • Xor
  • %

Question 157

Question
Suppose n is a variable of the type Byte and we wish, to check whether its fourth bit (from right) is ON or OFF. Which of the following statements will do this correctly?
Answer
  • if ((n&16) == 16) Console.WriteLine("Fourth bit is ON");
  • if ((n&8) == 8) Console.WriteLine("Fourth bit is ON");
  • if ((n ! 8) == 8) Console.WriteLine("Fourth bit is ON");
  • if ((n ^ 8) == 8) Console.WriteLine("Fourth bit is ON");
  • if ((n ~ 8) == 8) Console. WriteLine("Fourth bit is ON");

Question 158

Question
What will be the output of the C#.NET code snippet given below?
Answer
  • 5 6
  • 6 5
  • 6 6
  • 7 7

Question 159

Question
Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?
Answer
  • n = n && HF7
  • n = n & 16
  • n = n & 0xF7
  • n = n & HexF7
  • n = n & 8

Question 160

Question
What will be the output of the C#.NET code snippet given below?
Answer
  • 102 1 38
  • 108 0 32
  • 102 0 38
  • 1 0 1

Question 161

Question
Which of the following statements is correct about Bitwise | operator used in C#.NET?
Answer
  • The | operator can be used to put OFF a bit.
  • The | operator can be used to Invert a bit.
  • The | operator can be used to check whether a bit is ON.
  • The | operator can be used to check whether a bit is OFF.
  • The | operator can be used to put ON a bit.

Question 162

Question
Which of the following is NOT an Assignment operator in C#.NET?
Answer
  • \=
  • /=
  • *=
  • +=
  • %=

Question 163

Question
What will be the output of the C#.NET code snippet given below?
Answer
  • 8 4 16 12 20
  • 4 8 12 16 20
  • 4 8 16 32 64
  • 2 4 6 8 10

Question 164

Question
What will be the output of the C#.NET code snippet given below?
Answer
  • 10
  • 20
  • 30
  • Compile Error / Syntax Error

Question 165

Question
Which of the following statements are correct about the following code snippet? int a = 10; int b = 20; bool c; c = !(a > b); (choose 2)
Answer
  • There is no error in the code snippet.
  • An error will be reported since ! can work only with an int.
  • A value 1 will be assigned to c.
  • A value True will be assigned to c.
  • A value False will be assigned to c

Question 166

Question
Which of the following statements is correct about Bitwise ^ operator used in C#.NET?
Answer
  • The ^ operator can be used to put ON a bit.
  • The ^ operator can be used to put OFF a bit.
  • The ^ operator can be used to Invert a bit.
  • The ^ operator can be used to check whether a bit is ON.
  • The ^ operator can be used to check whether a bit is OFF.

Question 167

Question
Which of the following statements are correct? (choose 3)
Answer
  • The conditional operator (?:) returns one of two values depending on the value of a Boolean expression.
  • The as operator in C#.NET is used to perform conversions between compatible reference types.
  • The &* operator is also used to declare pointer types and to dereference pointers.
  • The -> operator combines pointer dereferencing and member access.
  • In addition to being used to specify the order of operations in an expression, brackets [ ] are used to sp

Question 168

Question
Which of the following statements is correct?
Answer
  • A constructor can be used to set default values and limit instantiation.
  • C# provides a copy constructor.
  • Destructors are used with classes as well as structures.
  • A class can have more than one destructor.

Question 169

Question
Which of the following statements is correct about the C#.NET code snippet given below?
Answer
  • func() is a valid overloaded function.
  • Overloading works only in case of subroutines and not in case of functions.
  • func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.
  • The call to i = s1.func() will assign 1 to i.
  • The call j = s1.func() will assign 2.4 to j.

Question 170

Question
Which of the following ways to create an object of the Sample class given below will work correctly?
Answer
  • Sample s3 = new Sample(10, 1.2f, 2.4);
  • Sample s1 = new Sample(, , 2.5);
  • Sample s2 = new Sample(10, 1.2f);
  • Sample s1 = new Sample(10);
  • Sample s1 = new Sample();

Question 171

Question
Which of the following statements are correct about static functions? 1. Static functions can access only static data. 2. Static functions cannot call instance functions. 3. It is necessary to initialize static data. 4. Instance functions can call static functions and access static data. 5. this reference is passed to static functions.
Answer
  • 1, 2, 4
  • 2, 3, 5
  • 3, 4
  • 4, 5
  • None of these

Question 172

Question
Which of the following statements is correct about constructors?
Answer
  • If we provide a one-argument constructor then the compiler still provides a zero-argument constructor.
  • Static constructors can use optional arguments.
  • Overloaded constructors cannot use optional arguments.
  • If we do not provide a constructor, then the compiler provides a zero-argument constructor.

Question 173

Question
Which of the following is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below? Sample s1 = new Sample(); Sample s2 = new Sample(9, 5.6f);
Answer
  • public Sample() { i = 0; j = 0.0f; } public Sample (int ii, Single jj) { i = ii; j = jj; }
  • public Sample (Optional int ii = 0, Optional Single jj = 0.0f) { i = ii; j = jj; }
  • public Sample (int ii, Single jj) { i = ii; j = jj; }
  • Sample s;
  • s = new Sample();

Question 174

Question
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
Answer
  • 2, 4
  • 3, 5
  • 1, 3, 5
  • 3, 4, 5

Question 175

Question
Can static procedures access instance data?
Answer
  • Yes
  • No

Question 176

Question
Which of the following statements are correct about constructors in C#.NET? 1. Constructors cannot be overloaded. 2. Constructors always have the name same as the name of the class. 3. Constructors are never called explicitly. 4. Constructors never return any value. 5. Constructors allocate space for the object in memory.
Answer
  • 1, 3, 5
  • 2, 3, 4
  • 3, 5
  • 4, 5
  • None of these

Question 177

Question
How many times can a constructor be called during lifetime of the object?
Answer
  • As many times as we call it.
  • Only once.
  • Depends upon a Project Setting made in Visual Studio.NET.
  • Any number of times before the object gets garbage collected.
  • Any number of times before the object is deleted.

Question 178

Question
Is it possible to invoke Garbage Collector explicitly?
Answer
  • Yes
  • No

Question 179

Question
Which of the following statements are correct about the C#.NET code snippet given below? class Sample { static int i; int j; public void proc1() { i = 11; j = 22; } public static void proc2() { i = 1; j = 2; } static Sample() { i = 0; j = 0; } }
Answer
  • i cannot be initialized in proc1().
  • proc1() can initialize i as well as j.
  • j can be initialized in proc2().
  • The constructor can never be declared as static.
  • proc2() can initialize i as well as j.

Question 180

Question
Which of the following statements is correct?
Answer
  • There is one garbage collector per program running in memory.
  • There is one common garbage collector for all programs.
  • An object is destroyed by the garbage collector when only one reference refers to it.
  • We have to specifically run the garbage collector after executing Visual Studio.NET.

Question 181

Question
Is it possible for you to prevent an object from being created by using zero argument constructor?
Answer
  • Yes
  • No

Question 182

Question
Which of the following statements are correct about static functions?
Answer
  • Static functions are invoked using objects of a class.
  • Static functions can access static data as well as instance data.
  • Static functions are outside the class scope.
  • Static functions are invoked using class.

Question 183

Question
What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class Sample { static Sample() { Console.Write("Sample class "); } public static void Bix1() { Console.Write("Bix1 method "); } } class MyProgram { static void Main(string[ ] args) { Sample.Bix1(); } } }
Answer
  • Sample class Bix1 method
  • Bix1 method
  • Sample class
  • Bix1 method Sample class
  • Sample class Sample class

Question 184

Question
Which of the following statements is correct about constructors in C#.NET?
Answer
  • A constructor cannot be declared as private.
  • A constructor cannot be overloaded.
  • A constructor can be a static constructor.
  • A constructor cannot access static data.
  • this reference is never passed to a constructor.

Question 185

Question
What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class Sample { public static void fun1() { Console.WriteLine("Bix1 method"); } public void fun2() { fun1(); Console.WriteLine("Bix2 method"); } public void fun2(int i) { Console.WriteLine(i); fun2(); } } class MyProgram { static void Main(string[ ] args) { Sample s = new Sample(); Sample.fun1(); s.fun2(123); } } }
Answer
  • Bix1 method 123 Bixl method Bix2 method
  • Bix1 method 123 Bix2 method
  • Bix2 method 123 Bix2 method Bixl method
  • Bixl method 123
  • Bix2 method 123 Bixl method

Question 186

Question
Which event would you use to run a method immediately after serialization occurs?
Answer
  • OnSerializing
  • OnDeserializing
  • OnSerialized
  • OnDeserialized
Show full summary Hide full summary

Similar

Conhecendo a Plataforma .NET
Diego Melo
.NET Framework
R A
Test .Net Developer questionnaire
tomasz.sulkowski
Sending a Fax (2 entry point) - [Inbound Flow]
Ajitpal Singh
.NET midterm question
BigDady313 .
.Net Lab Assignment
kuber sharma
.NET Angular
Pritesh Patel
Unit Testing In .NET
Pritesh Patel