Quiz
true .NET
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (185)
1Which of the following are value types? (Choose 3)
- ADecimal
- BString
- CSystem.Drawing.Point
- DInteger
2Which is the correct declaration for a nullable integer?
- ANullable(int) i = null;
- BNullable<int> i = null;
- Cint i = null;
- Dint<Nullable> i = null;
3Which of the following are reference types? (Choose 2)
- ATypes declared Nullable
- BString
- CException
- DAll types derived from System.Object
4What is the correct order for catch clauses when handling different exception types?
- AMost general to most specific
- BMost likely to occur to least likely to occur
- CMost specific to most general
- DLeast likely to occur to most likely to occur
5The following scenarios, which would be a good reason to use the String- Builder class instead of the String class?
- AWhen building a string from shorter strings
- BWhen working with text data longer than 256 bytes
- CWhen you want to search and replace the contents of a string
- DWhen a string is a value type
6Why should you close and dispose of resources in a finally block instead of a catch block?
- AIt keeps you from having to repeat the operation in each catch.
- BA finally block runs whether or not an exception occurs.
- CThe compiler throws an error if resources are not disposed of in the finally block.
- DYou cannot dispose of resources in a catch block.
7You 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?
- AMessage
- BStackTrace
- CSource
- DData
8You 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?
- AThe variable was not initialized before it was passed in.
- BPassing a value type into a procedure creates a copy of the data.
- CThe variable was redeclared within the procedure level.
- DThe procedure handled the variable as a reference.
9Which of the following statements are true? (Choose 2)
- AInheritance defines a contract between types.
- BInterfaces define a contract between types.
- CInheritance derives a type from a base type.
- DInterfaces derive a type from a base type.
10Which of the following are examples of built-in generic types? (Choose 2)
- ANullable
- BBoolean
- CEventHandler
- DSystem.Drawing.Point
11You 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?
- ACall the Object.Dispose method.
- BImplement the IDisposable interface.
- CDerive the generic class from the IDisposable class.
- DUse constraints to require the generic type to implement the IDisposable interface.
12You’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?
- AThe signature of the event procedure doesn’t match that defined by the delegate.
- BThe event procedure is declared Shared/static, but it should be an instance member instead.
- CYou mistyped the event procedure name when attaching it to the delegate.
- DThe class was created in a different language.
13You are creating a class that needs to be sorted when in a collection. Which interface should you implement?
- AIEquatable
- BIFormattable
- CIDisposable
- DIComparable
14Why should boxing be avoided?
- AIt adds overhead.
- BUsers must have administrative privileges to run the application.
- CIt makes code less readable.
15Structures inherit ToString from System.Object. Why would someone override that method within a structure? (Choose 2)
- ATo avoid boxing
- BTo return something other than the type name
- CThe compiler requires structures to override the ToString method
- DTo avoid run-time errors caused by invalid string conversions
16If there is no valid conversion between two types, what should you do when implementing the IConvertible interface?
- ADelete the ToType member that performs the conversion.
- BThrow an InvalidCastException.
- CThrow a new custom exception reporting the error.
- DLeave the member body empty.
17With strict conversions enabled, which of the following would allow an implicit conversion? (Choose 2)
- AInt16 to Int32
- BInt32 to Int16
- CInt16 to double
- DA double to Int16
18You need to retrieve a list of subdirectories. Which class should you use?
- AFileInfo
- BDriveInfo
- CFileSystemWatcher
- DDirectoryInfo
19Which of the following types of changes CANNOT be detected by an instance of FileSystemWatcher?
- AWhich of the following types of changes CANNOT be detected by an instance of FileSystemWatcher?
- BA USB flash drive connected to the computer
- CA directory added to the root of the C:\ drive
- DA file that is renamed
20You 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.)
- AFile fi = new File(); fi.Copy("file1.txt", "file2.txt");
- BFile.Copy("file1.txt", "file2.txt");
- CFileInfo fi = new FileInfo("file1.txt"); fi.CreateText(); fi.CopyTo("file2.txt");
- DFileInfo fi = new FileInfo("file1.txt"); fi.C1opyTo("file2.txt");
21You 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?
- AMemoryStream
- BBufferedStream
- CGZipStream
- DFileStream
22You 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.)
- AGZipStream
- BTextReader
- CStreamReader
- DBinaryReader
23You 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?
- AIsolatedStorageFile.GetUserStoreForAssembly()
- BIsolatedStorageFile.GetMachineStoreForAssembly()
- CIsolatedStorageFile.GetUserStoreForDomain()
- DIsolatedStorageFile.GetMachineStoreForDomain()
24You 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?
- As = Regex.Replace(s, "http://", "https://");
- Bs = Regex.Replace(s, "https://", "http://");
- Cs = Regex.Replace(s, "http://", "https://", RegexOptions.IgnoreCase);
- Ds = Regex.Replace(s, "https://", "http://", RegexOptions.IgnoreCase);
25You 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?
- Astring 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(); - Bstring 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(); - Cstring 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(); - Dstring 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();
- Astring p = @"First Name: (?<firstName>.*$)\n" +@"Last Name: (?<lastName>.*$)\n"
26Which of the following regular expressions matches the strings zoot and zot?
- Az(oo)+t
- Bzo*t$
- C$zo*t
- D^(zo)+t
27Which of the following strings match the regular expression ^a(mo)+t.*z$? (Choose 3)
- Aamotz
- Bamomtrewz
- Camotmoz
- Datrewz
- Eamomomottothez
28Which of the following encoding types would yield the largest file size?
- AUTF-32
- BUTF-16
- CUTF-8
- DASCII
29Which of the following encoding types support Chinese? (Choose 3)
- AUTF-32
- BUTF-16
- CUTF-8
- DASCII
30You need to decode a file encoded in ASCII. Which of the following decoding types would yield correct results? (Choose 2)
- AEncoding.UTF32
- BEncoding.UTF16
- CEncoding.UTF8
- DEncoding.UTF7
31You 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?
- Aiso-2022-kr
- Bx-EBCDIC-KoreanExtended
- Cx-mac-korean
- DUTF-16
32You 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?
- AStack.Pop
- BStack.Push
- CStack.Clear
- DStack.Peek
33You 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?
- AQueue
- BArrayList
- CStack
- DStringCollection
34You 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.)
- AImplement the IComparable interface.
- BCreate a method named CompareTo.
- CImplement the IEnumerable interface.
- DCreate a method named GetEnumerator.
35
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?- AHashTable
- BSortedList
- CStack
- DQueue
36You 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?
- Apublic class Products2 : StringDictionary{ }
- Bclass Products : Dictionary<string, Product>{ }
- Cclass Products : StringDictionary<string, Product>{ }
- D.class Products : Dictionary{ }
37You 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?
- Apublic 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); } } - Bpublic 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);}} - Cpublic 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);}} - Dpublic 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);}}
- Apublic class Product : IComparable { public string productName; public Product(string
38Which of the following are required to serialize an object? (Choose 2)
- AAn instance of BinaryFormatter or SoapFormatter File
- Bpermissions to create temporary files Microsoft Internet
- CInformation Services (IIS)
- DA stream object
39Which of the following attributes should you add to a class to enable it to be serialized?
- AISerializable
- BSerializable
- CSoapInclude
- DOnDeserialization
40Which of the following attributes should you add to a member to prevent it from being serialized by BinaryFormatter?
- ANonSerialized
- BSerializable
- CSerializationException
- DSoapIgnore
41Which of the following interfaces should you implement to enable you to run a method after an instance of your class is deserialized?
- AIFormatter
- BISerializable
- CIDeserializationCallback
- DIObjectReference
42Which of the following are requirements for a class to be serialized with XML serialization? (Choose 2)
- AThe class must be public.
- BThe class must have a constructor that accepts a SerializationInfo parameter.
- CThe class must be private.
- DThe class must have a parameterless constructor.
43Which of the following attributes would you use to cause a member to be serialized as an XML attribute, rather than as an XML element?
- AXmlType
- BXmlAttribute
- CXmlElement
- DXmlAnyAttribute
44Which tool would you use to help you create a class that, when serialized, would produce an XML document that conformed to an XML schema?
- AXsd.exe
- BXcacls.exe
- CXPadsi90.exe
- DXdcmake.exe
45Which of the following attributes should you add to a member to prevent it from being serialized by XML serialization?
- AXmlAttribute
- BXmlElement
- CXmlIgnore
- DXmlType
46Which parameters must a constructor accept if the class implements ISerializable? (Choose 2)
- AObjectManager
- BStreamingContext
- CFormatter
- DSerializationInfo
47Which event would you use to run a method immediately before deserialization occurs?
- AOnDeserialized
- BOnSerialized
- COnDeserializing
- DOnSerializing
48Which of the following are requirements for a method that is called in response to a serialization event? (Choose 2)
- AReturn a StreamingContext object.
- BReturn void.
- CAccept a SerializationInfo object as a parameter.
- DAccept a StreamingContext object as a parameter.
49Which of the following methods is the best to use to draw a square with a solidcolor?
- AGraphics.FillEllipse
- BGraphics.FillPolygon
- CGraphics.FillRectangle
- DGraphics.DrawEllipse
- EGraphics.DrawPolygon
- FGraphics.DrawRectangle
- GGraphics.DrawLines
50Which of the following methods is the best to use to draw an empty triangle?
- AGraphics.FillEllipse
- BGraphics.FillPolygon
- CGraphics.FillRectangle
- DGraphics.DrawEllipse
- EGraphics.DrawPolygon
- FGraphics.DrawRectangle
- GGraphics.DrawLines
51Which of the following classes is required to draw an empty circle? (Choose 2)
- ASystem.Drawing.Bitma
- BSystem.Drawing.Brush
- CSystem.Drawing.Pen
- DSystem.Drawing.Graphics
52Which 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?
- ASystem.Drawing.TextureBrush
- BSystem.Drawing.SolidBrush
- CSystem.Drawing.Drawing2D.LinearGradientBrush
- DSystem.Drawing.Drawing2D.PathGradientBrush
- ESystem.Drawing.Drawing2D.HatchBrush
53What 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);- AAn arrow pointing up
- BAn arrow pointing down
- CAn arrow pointing left
- DAn arrow pointing right
54Which of the following classes could you use to display a JPEG image from an existing file in a form? (Choose 2)
- ASystem.Windows.Forms.PictureBox
- BSystem.Drawing.Imaging.Metafile
- CSystem.Drawing.Bitmap
- DSystem.Drawing.Image
55How 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?
- ACreate 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.
- BCreate 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.
- CCreate 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.
- DCreate 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.
56Which format is the best choice to use if you want to save a photograph that could be opened by a wide variety of applications?
- AImageFormat.Png
- BImageFormat.Jpeg
- CImageFormat.Gif
- DImageFormat.Bmp
57Which 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?
- AImageFormat.Png
- BImageFormat.Jpeg
- CImageFormat.Bmp
- DImageFormat.Gif
58What are the steps for adding text to an image?
- ACreate a Bitmap object, a Font object, and a Brush object. Then call Bitmap.DrawString.
- BCreate a Graphics object, a Font object, and a Pen object. Then call Graphics.DrawString.
- CCreate a Graphics object, a Font object, and a Brush object. Then call Graphics.DrawString.
- DCreate a Graphics object and a string object. Then call string.Draw.
59Which class would you need to create an instance of to specify that a string should be centered when drawn?
- ALineAlignment
- BFormatFlags
- CStringAlignment
- DStringFormat
60Which of the following commands would cause a string to be flush left?
- AStringFormat.Alignment = Far
- BStringFormat.Alignment = Near
- CStringFormat.LineAlignment = Far
- DStringFormat.LineAlignment = Near
61You 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?
- AImage
- BBitmap
- CIcon
- DMetafile
62Which of the following statements are TRUE about the .NET CLR? (Choose 4)
- AIt provides services to run "unmanaged" applications.
- BThe resources are garbage collected.
- CIt ensures that an application would not be able to access memory that it is not authorized to access.
- DIt provides services to run "managed" applications.
- EIt provides a language-neutral development & execution environment.
63Which of the following are valid .NET CLR JIT performance counters? (Choose 2)
- APercentage of memory currently dedicated for JIT compilation
- BPercentage of processor time spent performing JIT compilation
- CNumber of methods that failed to compile with the standard JIT
- DAverage memory used for JIT compilation
- ETotal memory used for JIT compilation
64Which of the following statements is correct about Managed Code?
- AManaged code is the code that can run on top of Linux.
- BManaged code is the code that is written to target the services of the CLR.
- CManaged code is the code that runs on top of Windows.
- DManaged code is the code where resources are Garbage Collected.
- EManaged code is the code that is compiled by the JIT compilers.
65Which of the following are NOT true about .NET Framework? (Choose 2)
- AIt provides an event driven programming model for building Windows Device Drivers.
- BIt provides different programming models for Windows-based applications and Web- based applications.
- CIt provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party.
- DIt provides a code-execution environment that minimizes software deployment and versioning conflicts.
- EIt provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely.
66Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?
- AComponent Object Model
- BCommon Type System
- C.NET class libraries
- DCommon Language Infrastructure
- ECommon Language Runtime
67Which of the following jobs are NOT performed by Garbage Collector? (Choose 3)
- AClosing unclosed files.
- BClosing unclosed database collections.
- CFreeing memory occupied by unreferenced objects.
- DAvoiding memory leaks.
- EFreeing memory on the stack.
68Which of the following .NET components can be used to remove unused references from the managed heap?
- ACTS
- BClass Loader
- CGarbage Collector
- DCLR
- ECommon Language Infrastructure
69
Which of the following statements correctly define .NET Framework?- AIt is an environment for development and execution of Windows applications.
- BIt is an environment for developing, building, deploying and executing Web Services.
- CIt is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.
- DIt is an environment for developing, building, deploying and executing Distributed Applications.
- EIt is an environment for developing, building, deploying and executing only Web Applications.
70Which of the following constitutes the .NET Framework? (Choose 2)
- AWindows Services
- BWinForm Applications
- CFramework Class Library
- DCLR
- EASP.NET Applications
71Which of the following assemblies can be stored in Global Assembly Cache?
- AProtected Assemblies
- BPublic Assemblies
- CFriend Assemblies
- DShared Assemblies
- EPrivate Assemblies
72Code that targets the Common Language Runtime is known as
- ANative Code
- BManaged Code
- CLegacy
- DDistributed
- EUnmanaged
73Which of the following statements is correct about the .NET Framework?
- A.NET Framework uses COM+ services while creating Distributed Applications.
- B.NET Framework uses DCOM for creating unmanaged applications.
- C.NET Framework uses DCOM for making transition between managed and unmanaged code.
- D.NET Framework is built on the DCOM technology.
- E.NET Framework uses DCOM for achieving language interoperability.
74Which of the following is the root of the .NET type hierarchy?
- ASystem.Root
- BSystem.Parent
- CSystem.Base
- DSystem.Type
- ESystem.Object
75Which of the following benefits do we get on running managed code under CLR? (Choose 4)
- AType safety of the code running under CLR is assured.
- BIt is ensured that an application would not access the memory that it is not authorized to access.
- CIt launches separate process for every application running under it.
- DThe resources are Garbage collected.
- ETUT KOROCHE VSE RIGHT
76Which of the following statements are correct about JIT? (Choose 3)
- AJIT compiler compiles instructions into machine code at run time.
- BThe code compiler by the JIT compiler runs under CLR.
- CThe instructions compiled by JIT compilers are written in native code.
- DThe instructions compiled by JIT compilers are written in Intermediate Language (IL) code.
- EThe method is JIT compiled even if it is not called
77Which of the following are parts of the .NET Framework? (Choose 2)
- AThe Common Language Runtime (CLR)
- BThe Framework Class Libraries (FCL)
- CMicrosoft Published Web Services
- DApplications deployed on IIS
- EMobile Applications
78Which one of the following classes are present System.Collections.Generic namespace? (Choose 2)
- ASortedArray
- BSortedDictionary
- CTree
- DStack
79For 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(); } }
- ANone of the above.
- BCompiler will report an error: Operator '+' is not defined for types T and int.
- CProgram will generate run-time exception.
- DResult of addition is system-dependent.
- EAddition will produce result 1.
80Which of the following statements are valid about generics in .NET Framework? (Choose 2)
- AGenerics is a language feature.
- BWe can create a generic class, however, we cannot create a generic interface in C#.NET.
- CGenerics delegates are not allowed in C#.NET.
- DGenerics are useful in collection classes in .NET framework
- ENone of All
81Which of the following statements is valid about generic procedures in C#.NET?
- ANone of All.
- BGeneric procedures must take at least one type parameter.
- CGeneric procedures can take at the most one generic parameter.
- DOnly those procedures labeled as Generic are generic.
- EAll procedures in a Generic class are generic.
82For 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); }}- ANone of all.
- BProgram will generate a run-time exception.
- CCompiler will generate an error.
- DA non generic class Hello cannot have generic subroutine.
- EProgram will compile and on execution will print: Hello world
83For 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); }}
- ANone of the above.
- BMember Field of class Generic is not accessible directly.
- CCompiler will give an error.
- DName Generic cannot be used as a class name because it's a keyword.
- EIt will print string "Hello" on the console.
84For the code snippet given below, which of the following statements are valid? public class MyContainer<T> where T: IComparabte { // Insert code here } (Choose 2)
- AThis requirement on type argument is called as constraint
- BCompiler will report an error for this block of code.
- CType argument of class MyContainer must be IComparabte.
- DClass MyContainer requires that it's type argument must implement IComparable interface.
85For 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)
- AClass MyContainer requires that its type argument must be a reference type and it must implement IComparable interface.
- BThere are multiple constraints on type argument to MyContainer class.
- CCompiler will report an error for this block of code.
- DClass MyContainer requires that it's type argument must implement IComparable interface.
86Which of the following statements is valid about advantages of generics?
- ANone of the above.
- BGenerics eliminate the possibility of run-time errors.
- CGenerics provide type safety without the overhead of multiple implementations.
- DGenerics require use of explicit type casting.
- EGenerics shift the burden of type safety to the programmer rather than compiler.
87Which 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() { } }
- AMyClass is an abstract class.
- BA Method Table will not be created for class MyClass.
- CA subroutine cannot be declared inside an interface.
- DA function cannot be declared inside an interface.
- EThe definition of fun1() in class MyClass should be void IMyInterface.fun1().
88Which of the following can be declared in an interface? (Choose 3)
- AMethods
- BProperties
- CEnumerations
- DEvents
- EStructures
89Which of the following statements is correct about an interface used in C#.NET?
- AInterfaces cannot be inherited.
- BProperties can be declared inside an interface.
- CFrom two base interfaces a new interface cannot be inherited.
- DIn a program if one class implements an interface then no other class in the same program can implement this interface.
- EOne class can implement only one interface.
90Which of the following statements is correct about Interfaces used in C#.NET?
- AInterfaces can contain static data and methods.
- BInterfaces can contain only method declaration.
- CAll interfaces are derived from an Object interface.
- DInterfaces can be inherited.
- EAll interfaces are derived from an Object class.
91Which of the following statements is correct about an interface used in C#.NET?
- AIf a class implements an interface partially, then it should be an abstract class.
- BA class cannot implement an interface partially.
- CAn interface can contain static methods.
- DAn interface can contain static data.
- EMultiple interface inheritance is not allowed.
92Which of the following statements is correct about an interface?
- AOne interface can be implemented in another interface.
- BAn interface can be implemented by multiple classes in the same program.
- CA class that implements an interface can explicitly implement members of that interface.
- DThe functions declared in an interface have a body.
93Which of the following statements are correct about an interface in C#.NET? (Choose 3)
- AA class can implement multiple interfaces.
- BStructures cannot inherit a class but can implement an interface.
- CIn C#.NET, : is used to signify that a class member implements a specific interface.
- DAn interface can implement multiple classes.
- EThe static attribute can be used with a method that implements an interface declaration.
94Which of the following is the correct implementation of the interface given below? interface IMyInterface { double MyFun(Single i); }
- Aclass MyClass { double MyFun(Single i) as IMyInterface.MyFun { // Some code }}
- Bclass MyClass { MyFun (Single i) As Double {// Some code } }
- Cclass MyClass: implements IMyInterface { double fun(Single si) implements IMyInterface.MyFun() { //Some code } }
- Dclass MyClass: IMyInterface { double IMyInterface.MyFun(Single i) { // Some code } }
95Which of the following statements is correct?
- AWhen a class inherits an interface it inherits member definitions as well as its implementations.
- BAn interface cannot contain the signature of an indexer.
- CInterfaces members are automatically public.
- DTo implement an interface member, the corresponding member in the class must be public as well as static.
96Which of the following statements are correct about an interface used in C#.NET? (Choose 3)
- AAn interface can contain properties, methods and events.
- BThe keyword must implement forces implementation of an interface.
- CInterfaces can be overloaded.
- DInterfaces can be implemented by a class or a struct.
- EEnhanced implementations of an interface can be developed without breaking existing code.
97Which of the following can implement an interface? (Choose 2)
- AData
- BClass
- CEnum
- DStructure
- ENamespace
98Which 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 } }
- AClass MyClass is an abstract class.
- BClass MyClass cannot contain instance data.
- CClass MyClass fully implements the interface IMyInterface.
- DInterface IMyInterface should be inherited from the Object class.
- EThe compiler will report an error since the interface IMyInterface is only partially implemented.
99Which 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(); }
- AProperties cannot be declared inside an interface.
- BThis is a perfectly workable interface.
- CThe properties in the interface must have a body.
- DSubroutine in the interface must have a body.
- EFunctions cannot be declared inside an interface.
100Which of the following is the correct way to implement the interface given below?interface IPerson { String FirstName { get; set; } }
- Aclass Employee : IPerson{ private String str; public String FirstName { get
{ return str; } set { str = value; } } } - Bclass Employee{ private String str; public String IPerson.FirstName { get
{ return str; } set { str = value; } } } - Cclass Employee : implements IPerson{ private String str; public String FirstName
{ get { return str; } set { str = value; } } } - DNone of the above
- Aclass Employee : IPerson{ private String str; public String FirstName { get
101Which of the following can be facilitated by the Inheritance mechanism? (Choose 3)
- AUse the existing functionality of base class.
- BOverrride the existing functionality of base class.
- CImplement new functionality in the derived class.
- DImplement polymorphic behaviour.
- EImplement containership.
102Which 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 ***] } }- AConsole.WriteLine(base.i + " " + i);
- BConsole.WriteLine(i + " " + base.i);
- CConsole.WriteLine(mybase.i + " " + i);
- DConsole.WriteLine(i + " " + mybase.i);
- EConsole.WriteLine(i + " " + this.i);
103Which 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)- Acount should be declared as public if it is to become available in the inheritance
chain. - Bcount should be declared as protected if it is to become available in the
inheritance chain. - CWhile constructing an object referred to by i firstly constructor of index class will be called followed by constructor of index1 class.
- DConstructor of index class does not get inherited in index1 class.
- Ecount should be declared as Friend if it is to become available in the inheritance
chain.
- Acount should be declared as public if it is to become available in the inheritance
104What 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(); } }}- A24 bytes
- B12 bytes
- C20 bytes
- D10 bytes
- E16 bytes
105Which 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(); } } }- AA.fun();
- Bmybase.fun();
- CA::fun();
- Dfun();
- Ebase.fun();
106Which of the following should be used to implement a 'Has a' relationship between two entities?
- APolymorphism
- BTemplates
- CContainership
- DEncapsulation
- EInheritance
107Which 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);
} } }- AThe program gives the output as: Hi Hello Bye
- BThe program gives the output as: Bye Hello
- CThe program gives the output as: Hi Bye Hello
- DError in the program
108In an inheritance chain which of the following members of base class are accessible to the derived class members? (Choose 2)
- Astatic
- Bprotected
- Cprivate
- Dshared
- Epublic
109Which of the following are reuse mechanisms available in C#.NET? (Choose 2)
- AInheritance
- BEncapsulation
- CTemplates
- DContainership
- EPolymorphism
110Which of the following should be used to implement a 'Like a' or a 'Kind of' relationship between two entities?
- APolymorphism
- BContainership
- CTemplates
- DEncapsulation
- EInheritance
111How can you prevent inheritance from a class in C#.NET ?
- ADeclare the class as shadows.
- BDeclare the class as overloads.
- CDeclare the class as sealed.
- DDeclare the class as suppress.
- EDeclare the class as override.
112Which of the following statements are correct about Inheritance in C#.NET? (Choose 3)
- AInheritance cannot suppress the base class functionality.
- BA derived class object contains all the base class data.
- CA derived class may not be able to access all the base class data.
- DInheritance cannot extend the base class functionality.
- EIn inheritance chain construction of object happens from base towards derived.
113Assume class B is inherited from class A. Which of the following statements is correct about construction of an object of class B?
- AWhile creating the object firstly the constructor of class B will be called followed by constructor of class A.
- BWhile creating the object firstly the constructor of class A will be called followed by constructor of class B.
- CThe constructor of only class B will be called.
- DThe constructor of only class A will be called.
- EThe order of calling constructors depends upon whether constructors in class Aand class B are private or public.
114Which 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); } } }- AThe program will work correctly only if we implement zero-argument constructors in Baseclass as well as Derived class.
- BThe program will output: Derived Base
- CThe program will report an error in the statement base(ii).
- DThe program will work correctly if we replace base(ii) withbase.Baseclass(ii).
- EThe program will output: Base Derived
115Which of the following statements are correct about an ArrayList collection that implements the IEnumerable interface? (Choose 3)
- AThe ArrayList class contains an inner class that implements the IEnumeratorinterface.
- BAn ArrayList Collection cannot be accessed simultaneously by different threads.
- CThe inner class of ArrayList can access ArrayList class's members.
- DTo access members of ArrayList from the inner class, it is necessary to passArrayList class's reference to it.
- EEnumerator's of ArrayList Collection can manipulate the array.
116How many enumerators will exist if four threads are simultaneously working on an ArrayList object?
- A1
- B3
- C2
- D4
- EDepends upon the Project Setting made in Visual Studio.NET.
117In which of the following collections is the Input/Output index-based? (choose 2)
- AStack
- BQueue
- CBitArray
- DArrayList
- EHashTable
118In which of the following collections is the Input/Output based on a key? (choose 2)
- AMap
- BStack
- CBitArray
- DHashTable
- ESortedList
119In a HashTable Key cannot be null, but Value can be.
- ATrue
- BFalse
120Which 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);
- ADissimilar elements like "hello", 8.2, 5 cannot be stored in the same Stackcollection.
- BBoolean values can never be stored in Stack collection.
- CIn the fourth call to Push(), we should write "b" in place of 'b'.
- DTo store dissimilar elements in a Stack collection, a method PushAnyType()should be used in place of Push().
- EThis is a perfectly workable code.
121Which of the following statements are correct about the Stack collection? (choose 3)
- AIt can be used for evaluation of expressions.
- BAll elements in the Stack collection can be accessed using an enumerator.
- CIt is used to maintain a FIFO list.
- DAll elements stored in a Stack collection must be of similar type.
- ETop-most element of the Stack collection can be accessed using the Peek()method.
122A 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?
- At.ContainsKey("KKK");
- Bt.HasValue("KKK");
- Ct.HasKey("KKK");
- Dt.ContainsState("KKK");
- Et.ContainsValue("KKK");
123Which 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);
- AIEnumerator e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
- BIEnumerable e; e = q.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
- CIEnumerator e;e = q.GetEnumerable(); while (e.MoveNext()) Console.WriteLine(e.Current);
- DIEnumerator e;e = Queue.GetEnumerator(); while (e.MoveNext()) Console.WriteLine(e.Current);
124Which of the following is NOT an interface declared in System.Collections namespace?
- AIComparer
- BIEnumerable
- CIEnumerator
- DIDictionaryComparer
- EIDictionaryEnumerator
125Suppose 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?- A4
- B8
- C16
- D32
126Which of the following is an ordered collection class? (choose 2)
- AMap
- BStack
- CQueue
- DBitArray
- EHashTabe
127Which of the following is the correct way to find out the number of elements currently present in an ArrayList Collection called arr?
- Aarr.UpperBound
- Barr.Count
- Carr.GrowSize
- Darr.MaxIndex
- Earr.Capacity
128Which of the following statements are correct about a HashTable collection? (choose 3)
- AIt is a keyed collection.
- BIt is a ordered collection.
- CIt is an indexed collection.
- DIt implements a IDictionaryEnumerator interface in its inner class.
- EThe key - value pairs present in a HashTable can be accessed using the Keysand Values properties of the inner class that implements theIDictionaryEnumerator interface.
129Which 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);
- AIEnumerable e; e = st.GetEnumerator();while (e.MoveNext())Console.WriteLine(e.Current);
- BIEnumerator e;e = st.GetEnumerable();while (e.MoveNext())Console.WriteLine(e.Current);
- CIEnumerator e; e = st.GetEnumerator();while (e.MoveNext())Console.WriteLine(e.Current);
- DIEnumerator e; e = Stack.GetEnumerator();while (e.MoveNext()) Console.WriteLine(e.Current);
130Which of the following statements are correct about the Collection Classes available in Framework Class Library?
- AElements of a collection cannot be transmitted over a network.
- BElements stored in a collection can be retrieved but cannot be modified.
- CIt is not easy to adopt the existing Collection classes for newtype of objects.
- DElements stored in a collection can be modified only if allelements are of similar types.
- EThey use efficient algorithms to manage the collection, thereby improving the performance of the program.
131The authorization settings in web.config overlap settings available in IIS. Options
- ATrue
- BFalse
132What component of a Data Provider provides connected, forward-only, read- only access to a database?
- ADataAdapter
- BCommand object
- CConnection object
- DDataReader object
133A DataAdapter facilitates disconnected data access.
- ATrue
- BFalse
134Which of the following refers to providing new culture-specific resources and retrieving the appropriate resource based on the culture setting?
- ALocalization
- BGlobalization
- COverloading
- DEncapsulation
135Which of the following automatically detects if windows installer is installed on the target machine?
- AAssembly
- BNative image
- CBootstrapper application
- DGlobalization
136 ______is the verification that all callers to code have appropriate permission to access it.
- ACode tuning
- BCode access security
- CCommon language runtime
- DCommon type system
137Which ensures that users of your application have appropriate permission to access your application based on the identity of the user?
- ACode-access security
- BRole-based security
138If no access modifier is specified for a class or a structure, it is considered .....
- Aprivate
- Bpublic
- Cinternal
- Dprotected
139Enumerations must be of a numeric integral type.
- ATrue
- BFalse
140Which of the following is not correct for delegates?
- AIt provides the functionality behind events.
- BIt is a strongly typed function pointer.
- CIt can be used to invoke a method without making an explicit call to that method.
- DIt can not be used for creation of association between events and event handlers.
141 ___is the ability of different objects to expose different implementations of the same public interface.
- AEncapsulation
- BOverriding
- CPolymorphism
- DAbstraction
142Returns a result set by way of a DataReader object.
- AExecuteNonQuery
- BExecuteScalar
- CExecuteReader
143Which of the following is not true for shared assembly?
- AIt can be accessed by multiple programs at once.
- BIt must be installed to the GAC.
- CIt can be accessed only by one application.
144Which type of assembly should be created when you want to provide different sets of resources for different culture?
- APrivate assembly
- BSatellite assembly
- CShared assembly
145Inheriting from a base class and providing a new method for one of the base class methods
- AOverriding
- BOverloading
- CShadowing
- DAbstracting
146It contains all the information needed to describe the assembly to the common language runtime.
- ABootstrapper
- BAssembly manifest
- CGAC
- DStrong Name
147You 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?- AIsolatedStorageFile store;store = IsolatedStorageFile.GetMachineStoreForAssembly();store.CreateDirectory("MyPrefer");
- BIsolatedStorageFile store;store = IsolatedStorageFile.GetUserStoreForApplication();store.CreateDirectory("MyPrefer");
- CIsolatedStorageFile store;store = IsolatedStorageFile.GetUserStoreForAssembly();store.CreateDirectory("MyPrefer");
- DIsolatedStorageFile store;store = IsolatedStorageFile.GetMachineStoreForApplication();store.CreateDirectory("MyPrefer");
148ОТВЕТ НЕ ТОЧЕН
Which of the following are the correct ways to increment the value of variable a by 1? (choose 2)- A++a++;
- Ba += 1;
- Ca ++ 1;
- Da = a +1;
- Ea = +1;
149What will be the output of the C#.NET code snippet given below?

- A163 92
- B92 163
- C192 63
- D0 1
150Which of the following is NOT an Arithmetic operator in C#.NET?
- A**
- B+
- C/
- D%
- E*
151Which of the following is NOT a Bitwise operator in C#.NET?
- A&
- B|
- C<<
- D^
- E~
152Which of the following statements is correct about the C#.NET code snippet given below? int d; d = Convert.ToInt32( !(30 < 20) );
- AA value 0 will be assigned to d.
- BA value 1 will be assigned to d.
- CA value -1 will be assigned to d.
- DThe code reports an error.
- EThe code snippet will work correctly if ! is replaced by Not.
153Which of the following are NOT Relational operators in C#.NET?
- A>=
- B!=
- CNot
- D<=
- E<>=
154Which of the following is the correct output for the C#.NET code snippet given below? Console.WriteLine(13 / 2 + " " + 13 % 2);
- A6.5 1
- B6.5 0
- C6 0
- D6 1
- E6.5 6.5
155Which of the following statements are correct about the Bitwise & operator used in C#.NET? (choose 3)
- AThe & operator can be used to Invert a bit.
- BThe & operator can be used to put ON a bit.
- CThe & operator can be used to put OFF a bit.
- DThe & operator can be used to check whether a bit is ON.
- EThe & operator can be used to check whether a bit is OFF.
156Which of the following are Logical operators in C#.NET? (choose 3)
- A&&
- B||
- C!
- DXor
- E%
157Suppose 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?
- Aif ((n&16) == 16) Console.WriteLine("Fourth bit is ON");
- Bif ((n&8) == 8) Console.WriteLine("Fourth bit is ON");
- Cif ((n ! 8) == 8) Console.WriteLine("Fourth bit is ON");
- Dif ((n ^ 8) == 8) Console.WriteLine("Fourth bit is ON");
- Eif ((n ~ 8) == 8) Console. WriteLine("Fourth bit is ON");
158What will be the output of the C#.NET code snippet given below?

- A5 6
- B6 5
- C6 6
- D7 7
159Suppose 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?
- An = n && HF7
- Bn = n & 16
- Cn = n & 0xF7
- Dn = n & HexF7
- En = n & 8
160What will be the output of the C#.NET code snippet given below?

- A102 1 38
- B108 0 32
- C102 0 38
- D1 0 1
161Which of the following statements is correct about Bitwise | operator used in C#.NET?
- AThe | operator can be used to put OFF a bit.
- BThe | operator can be used to Invert a bit.
- CThe | operator can be used to check whether a bit is ON.
- DThe | operator can be used to check whether a bit is OFF.
- EThe | operator can be used to put ON a bit.
162Which of the following is NOT an Assignment operator in C#.NET?
- A\=
- B/=
- C*=
- D+=
- E%=
163What will be the output of the C#.NET code snippet given below?

- A8 4 16 12 20
- B4 8 12 16 20
- C4 8 16 32 64
- D2 4 6 8 10
164What will be the output of the C#.NET code snippet given below?

- A10
- B20
- C30
- DCompile Error / Syntax Error
165Which of the following statements are correct about the following code snippet? int a = 10; int b = 20; bool c; c = !(a > b); (choose 2)
- AThere is no error in the code snippet.
- BAn error will be reported since ! can work only with an int.
- CA value 1 will be assigned to c.
- DA value True will be assigned to c.
- EA value False will be assigned to c
166Which of the following statements is correct about Bitwise ^ operator used in C#.NET?
- AThe ^ operator can be used to put ON a bit.
- BThe ^ operator can be used to put OFF a bit.
- CThe ^ operator can be used to Invert a bit.
- DThe ^ operator can be used to check whether a bit is ON.
- EThe ^ operator can be used to check whether a bit is OFF.
167Which of the following statements are correct? (choose 3)
- AThe conditional operator (?:) returns one of two values depending on the value of a Boolean expression.
- BThe as operator in C#.NET is used to perform conversions between compatible reference types.
- CThe &* operator is also used to declare pointer types and to dereference pointers.
- DThe -> operator combines pointer dereferencing and member access.
- EIn addition to being used to specify the order of operations in an expression, brackets [
] are used to sp
168Which of the following statements is correct?
- AA constructor can be used to set default values and limit instantiation.
- BC# provides a copy constructor.
- CDestructors are used with classes as well as structures.
- DA class can have more than one destructor.
169Which of the following statements is correct about the C#.NET code snippet given below?

- Afunc() is a valid overloaded function.
- BOverloading works only in case of subroutines and not in case of functions.
- Cfunc() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.
- DThe call to i = s1.func() will assign 1 to i.
- EThe call j = s1.func() will assign 2.4 to j.
170Which of the following ways to create an object of the Sample class given below will work correctly?

- ASample s3 = new Sample(10, 1.2f, 2.4);
- BSample s1 = new Sample(, , 2.5);
- CSample s2 = new Sample(10, 1.2f);
- DSample s1 = new Sample(10);
- ESample s1 = new Sample();
171Which 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.- A1, 2, 4
- B2, 3, 5
- C3, 4
- D4, 5
- ENone of these
172Which of the following statements is correct about constructors?
- AIf we provide a one-argument constructor then the compiler still provides a zero-argument constructor.
- BStatic constructors can use optional arguments.
- COverloaded constructors cannot use optional arguments.
- DIf we do not provide a constructor, then the compiler provides a zero-argument constructor.
173Which 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);- Apublic Sample()
{
i = 0;
j = 0.0f;
}
public Sample (int ii, Single jj)
{
i = ii;
j = jj;
} - Bpublic Sample (Optional int ii = 0, Optional Single jj = 0.0f)
{
i = ii;
j = jj;
} - Cpublic Sample (int ii, Single jj)
{
i = ii;
j = jj;
} - DSample s;
- Es = new Sample();
- Apublic Sample()
174In which of the following should the methods of a class differ if they are to be treated as overloaded methods?
- A2, 4
- B3, 5
- C1, 3, 5
- D3, 4, 5
175Can static procedures access instance data?
- AYes
- BNo
176Which 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.- A1, 3, 5
- B2, 3, 4
- C3, 5
- D4, 5
- ENone of these
177How many times can a constructor be called during lifetime of the object?
- AAs many times as we call it.
- BOnly once.
- CDepends upon a Project Setting made in Visual Studio.NET.
- DAny number of times before the object gets garbage collected.
- EAny number of times before the object is deleted.
178Is it possible to invoke Garbage Collector explicitly?
- AYes
- BNo
179
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;
}
}- Ai cannot be initialized in proc1().
- Bproc1() can initialize i as well as j.
- Cj can be initialized in proc2().
- DThe constructor can never be declared as static.
- Eproc2() can initialize i as well as j.
180Which of the following statements is correct?
- AThere is one garbage collector per program running in memory.
- BThere is one common garbage collector for all programs.
- CAn object is destroyed by the garbage collector when only one reference refers to it.
- DWe have to specifically run the garbage collector after executing Visual Studio.NET.
181Is it possible for you to prevent an object from being created by using zero argument constructor?
- AYes
- BNo
182Which of the following statements are correct about static functions?
- AStatic functions are invoked using objects of a class.
- BStatic functions can access static data as well as instance data.
- CStatic functions are outside the class scope.
- DStatic functions are invoked using class.
183What 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();
}
}
}- ASample class Bix1 method
- BBix1 method
- CSample class
- DBix1 method Sample class
- ESample class Sample class
184Which of the following statements is correct about constructors in C#.NET?
- AA constructor cannot be declared as private.
- BA constructor cannot be overloaded.
- CA constructor can be a static constructor.
- DA constructor cannot access static data.
- Ethis reference is never passed to a constructor.
185
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);
}
}
}- ABix1 method
123
Bixl method
Bix2 method - BBix1 method
123
Bix2 method - CBix2 method
123
Bix2 method
Bixl method - DBixl method
123 - EBix2 method
123
Bixl method
- ABix1 method
Information
- Description
- Quiz on true .NET, created by Арман Киалбеков on 17/05/2018.
- Author
- Арман Киалбеков
- Language
- English
- Views
- 4
- Tags
- Rating
- No ratings yet Rate this quiz