C# .NET Test

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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

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

If a method is marked as protected internal who can access it? (A) Classes within the same assembly, and classes derived from the declaring class. (B) Internal methods can be only be called using reflection. (C) Only methods that are in the same class as the method in question. (D) Classes that are both in the same assembly and derived from the declaring class.

(A) Classes within the same assembly, and classes derived from the declaring class.

What is the difference between Convert.ToString(str) and str.ToString() method? (A) Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception. (B) str.ToString() function handles NULL while Convert.ToString(str) does not. It will throw a NULL reference exception. (C) Both can handle NULL (D) None can Handle NULL

(A) Convert.ToString(str) function handles NULL while str.ToString() does not. It will throw a NULL reference exception.

Which of the following statements correctly define .NET Framework? (A) It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services. (B) It is an environment for developing, building, deploying and executing Distributed Applications. (C) It is an environment for development and execution of Windows applications. (D) It is an environment for developing, building, deploying and executing only Web Applications.

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

A variable which is declared inside a method is called a________variable (A) Local (B) Private (C) Static (D) Serial

(A) Local

An Event has _____ as default return type (A) No return type for events (B) String (C) Double (D) Integer

(A) No return type for events

Two methods with the same name but with different parameters. (A) Overloading (B) Overriding (C) Duplexing (D) Loading

(A) Overloading

A class that cannot be inherited is what type of class? (A) Sealed (B) Gather (C) Static (D) Construct

(A) Sealed

Which of the following is the root of the .NET type hierarchy? (A) System.Object (B) System.Base (C) System.Root (D) System.Parent

(A) System.Object

Sealed Classes cannot be a base class. (A) True (B) False

(A) True

Is it possible to change the value of a variable while debugging a C# application? (A) Yes (B) No

(A) Yes

Are private class-level variables can inherited? (A) Yes, and we can access them (B) No, and we can not access them (C) Yes, but we can not access them (D) All of the above are wrong

(A) Yes, and we can access them

Which of the following are not types of access modifiers in C#? (A) external protect (B) internal protect (C) protect (D) internal

(A) external protect

Your company uses Visual Studio .NET as its application development platform. You have recently finished development of a class named ShopList using the .NET Framework. The class will include ShopItem objects that have the public properties exhibit below: 1. Name 2. ID 3. DiscountCode You need to enable users of the class to iterate through the ShopList collection, and to list each product's name and ID using the foreach statement. Which of the following code segments will you use to accomplish this task? (A) public class ShopList : IEnumerator, IEnumerable { // Class implementation } (B) public class ShopList : IBindingList { // Class implementation } (C) public class ShopList : ICollection { // Class implementation } (D) public class ShopList : IDictionary { // Class implementation }

(A) public class ShopList : IEnumerator, IEnumerable { // Class implementation }

Which file contains configuration data for each unique URl resource used in project? (A) web.config (B) global.asax (C) webapplication.vsdisco (D) assemblyinfo.cs

(A) web.config

Which of the following jobs are NOT performed by Garbage Collector? 1.Freeing memory on the stack. 2.Avoiding memory leaks. 3.Freeing memory occupied by unreferenced objects. 4.Closing unclosed database collections. 5.Closing unclosed files. (A) 1, 2, 3 (B) 1, 4, 5 (C) 3, 5 (D) 3, 4

(B) 1, 4, 5

What is a delegate? (A) A reference to an object in a different process. (B) A strongly typed function pointer. (C) An inter-process message channel. (D) A light weight thread or process that can call a single method.

(B) A strongly typed function pointer.

In C#, by default structs are passed how? (A) By reference. (B) By value. (C) By address. (D) By memory.

(B) By value

Convert vs. Parse methods: (A) Convert converts the value, Parse is for parsing (B) Convert allows null values, Parse cannot (C) Both are same (D) None of these

(B) Convert allows null values, Parse cannot

Which of the following .NET components can be used to remove unused references from the managed heap? (A) Class Loader (B) Garbage Collector (C) CTS (D) CLR

(B) Garbage Collector

What is the output of the code public class B : A { } (A) It defines a class that inherits the public methods of A only. (B) It defines a class that inherits all the methods of A but the private members cannot be accessed. (C) Errors (D) a and b

(B) It defines a class that inherits all the methods of A but the private members cannot be accessed.

Which keyword is used to achieve shadowing in C#? (A) Abstract (B) New (C) Shadow (D) Sealed

(B) New

Can an Interface be instantiated directly? (A) Yes (B) No

(B) No

Can we override private virtual methods? (A) Yes (B) No

(B) No

What is Polymorphism? (A) Polymorphism means multiple forms and different name (B) Polymorphism means multiple forms but one name (C) Polymorphism means single forms and single name (D) All of the above are true

(B) Polymorphism means multiple forms but one name

Which of the following class cannot be inherited? (A) Abstract (B) Sealed (C) Both (D) None

(B) Sealed

___________________ allow to encapsulate discrete units of functionality and provide a graphical representation of that functionality to the user (A) object (B) controls (C) class (D) graphics

(B) controls

Which of the following statements is correct about the C#.NET code snippet given below? namespace PskillsConsoleApplication { class Sample { public int func() { return 1; } public Single func() { return 2.4f ; } } class Program { static void Main(string[ ] args) { Sample s1 = new Sample(); int i; i = s1.func(); Single j; j = s1.func(); } } } (A) func() is a valid overloaded function. (B) func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions. (C) Overloading works only in case of subroutines and not in case of functions. (D) The call j = s1.func() will assign 2.4 to j.

(B) func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions.

Which of these statements correctly declares a two-dimensional array in C#? (A) int[][] myArray; (B) int[,] myArray; (C) System.Array[2] myArray; (D) int[2] myArray;

(B) int[,] myArray

How many web.config files that can be there an ASP.NET application? (A) only one (B) more than on (C) only two (D) up to 10

(B) more than one

Which 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 uses DCOM for achieving language interoperability

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

What compiler switch creates an xml file from the xml comments in the files in an assembly? (A) /text (B) /xml (C) /doc (D) /help

(C) /doc

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. (A) 1, 2, 3 (B) 1, 2, 5 (C) 1, 2, 4 (D) 2, 3, 5

(C) 1, 2, 4

Which of the following constitutes the .NET Framework? 1. ASP.NET Applications 2. CLR 3. Framework Class Library 4. WinForm Applications 5. Windows Services (A) 2, 5 (B) 2, 1 (C) 2, 3 (D) 3, 4

(C) 2, 3

Which is true about Interface and abstract methods? (A) We can write only one abstract method inside interface. (B) No method is abstract inside interface (C) All the methods inside Interface in an abstract method. (D) None of the above

(C) All the methods inside Interface in an abstract method.

Which of the following is/are not true about the class? (A) Classes can have both contractors and destructors (B) Classes are reference type (C) Classes does not support Inheritance (D) All of the above are true

(C) Classes does not support Inheritance

When doing an Update, which method of the SqlCommand is best to use? (A) ExecuteQuery (B) ExecuteUpdate (C) ExecuteNonQuery (D) ExecuteCommand

(C) ExecuteNonQuery

Which of the following is/are not types of arrays in C#? (A) Single-Dimensional (B) Multidimensional (C) Jazzed arrays (D) Jagged arrays

(C) Jazzed arrays

int keyword targets to which .Net type? (A) System.Int8 (B) System.Int16 (C) System.Int32 (D) System.Int64

(C) System.Int32

In C#, the statement that is used to replace multiple if statements is called? (A) The nestedif statement (B) The #endif statement (C) The switch case statement (D) None of these

(C) The switch case statement

Boxing in .Net allows the user to convert: (A) a double type to interger (B) a interger type to double (C) a value type to a reference type (D) a reference type to a value type

(C) a value type to a reference type

C# doesnot support: (A) abstraction (B) polymorphism (C) multiple inheritance (D) inheritance

(C) multiple inheritance

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; } } (A) j can be initialized in proc2(). (B) i cannot be initialized in proc1(). (C) proc1() can initialize i as well as j. (D) proc2() can initialize i as well as j.

(C) proc1() can initialize i as well as j

An assembly is: (A) declarative syntax of Java (B) properties of c# (C) events Of c# (D) A collection of files that appear to the programmer to be a single DLL or EXE.

(D) A collection of files that appear to the programmer to be a single DLL or EXE.

Different ways a method can be overloaded in C#.NET: (A) Different parameter data types (B) Different order of parameters (C) Different number of parameters (D) All of above

(D) All of above

What does a strong name contain? (A) public key (B) assembly name (C) assembly version (D) All of the above

(D) All of the above

Which of the following namespaces used in C#.NET? (A) using System; (B) using System.Collections.Generic; (C) using System.Windows.Forms; (D) All of the above are used

(D) All of the above are used

Which of the following statements is correct about constructors? (A) Static constructors can use optional arguments. (B) Overloaded constructors cannot use optional arguments. (C) If we provide a one-argument constructor then the compiler still provides a zero-argument constructor. (D) If we do not provide a constructor, then the compiler provides a zero-argument constructor.

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

Features of Read only variables (A) Declaration and initialization is separated (B) It is allocated at compile time (C) It is allocated at runtime (D) all of the above

(D) all of the above

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

4 & 5

What is an ENUM

It is used to define constants.


Ensembles d'études connexes

Med Surg Chap 44 Nursing management: Liver, Pancreas, biliary tract problems

View Set

Microecon Final Exam Practice Test

View Set

Ch. 4 Payment Instruments and Systems

View Set