C# MassiveStudy

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

Which of the following are Logical operators in C#.NET? 1. && 2. || 3. ! 4. Xor 5. %

1, 2, 3

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

1, 2, 3

Which of the following statements are correct about a .NET Assembly? 1. It is the smallest deployable unit. 2. Each assembly has only one entry point - Main(), WinMain() or DLLMain(). 3. An assembly can be a Shared assembly or a Private assembly. 4. An assembly can contain only code and data. 5. An assembly is always in the form of an EXE file.

1, 2, 3

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

1, 2, 3, 4

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.

1, 2, 4

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

1, 2, 4

Which of the following statements are correct? 1. The signature of an indexer consists of the number and types of its formal parameters. 2. Indexers are similar to properties except that their accessors take parameters. 3. Accessors of interface indexers use modifiers. 4. The type of an indexer and the type of its parameters must be at least as accessible as the indexer itself. 5. An interface accessor contains a body.

1, 2, 4

Which of the following statements are correct about the String Class in C#.NET? 1. Two strings can be concatenated by using an expression of the form s3 = s1 + s2; 2. String is a primitive in C#.NET. 3. A string built using StringBuilder Class is Mutable. 4. A string built using String Class is Immutable. 5. Two strings can be concatenated by using an expression of the form s3 = s1&s2;

1, 3, 4

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

1, 3, 5

Which of the folowing does an indexer allow to index in the same way as an array? 1. A class 2. A property 3. A struct 4. A function 5. An interface

1, 3, 5

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

1, 4

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.

1, 4, 5

What will be the output of the C#.NET code snippet given below? int num = 1, z = 5; if (!(num <= 0)) Console.WriteLine( ++num + z++ + " " + ++z ); else Console.WriteLine( --num + z-- + " " + --z );

7 7

Which of the following unary operators can be overloaded? 1. true 2. false 3. + 4. new 5. is

A. 1, 2, 3

What will be the output of the C#.NET code snippet given below? byte b1 = 0xF7; byte b2 = 0xAB; byte temp; temp = (byte)(b1 & b2); Console.Write (temp + " "); temp = (byte)(b1^b2); Console.WriteLine(temp); A. 163 92 B. 92 163 C. 192 63 D. 0 1

A. 163 92

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

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

An Account class has a property called accountNo and acc is a reference to a bank object and we want the C#.NET code snippet given below to work. Which of the following options will ensure this functionality? acc.accountNo = 10; Console.WriteLine(acc.accountNo); A. Declare accountNo property with both get and set accessors. B. Declare accountNo property with only get accessor. C. Declare accountNo property with get, set and normal accessors. D. Declare accountNo property with only set accessor. E. None of the above

A. Declare accountNo property with both get and set accessors.

An Employee class has a property called age and emp is reference to a Employee object and we want the statement Console.WriteLine(emp.age) to fail. Which of the following options will ensure this functionality? A. Declare age property with only get accessor. B. Declare age property with only set accessor. C. Declare age property with both get and set accessors. D. Declare age property with get, set and normal accessors. E. None of the above

B. Declare age property with only set accessor.

Can static procedures access instance data? A. Yes B. No

B. No

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

B. Only once.

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

B. There is one common garbage collector for all programs.

Which of the following utilities can be used to compile managed assemblies into processor-specific native code? A. gacutil B. ngen C. sn D. dumpbin E. ildasm

B. ngen

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. i cannot be initialized in proc1(). B. proc1() can initialize i as well as j. C. j can be initialized in proc2(). D. The constructor can never be declared as static. E. proc2() can initialize i as well as j.

B. proc1() can initialize i as well as j.

If Sample class has a Length property with get accessor then which of the following statements will work correctly? A. Sample m = new Sample(); m.Length = 10; B. Sample m = new Sample(); m.Length = m.Length + 20; C. Sample m = new Sample(); int l; l = m.Length; D. Sample.Length = 20; E. Console.WriteLine(Sample.Length);

C. Sample m = new Sample(); int l; l = m.Length;

Which of the following statements will correctly copy the contents of one string into another ? A. String s1 = "String"; String s2; s2 = s1; B. String s1 = "String" ; String s2; s2 = String.Concat(s1, s2); C. String s1 = "String"; String s2; s2 = String.Copy(s1); D. String s1 = "String"; String s2; s2 = s1.Replace(); E. String s1 = "String"; String s2; s2 = s2.StringCopy(s1);

C. String s1 = "String"; String s2; s2 = String.Copy(s1);

Which of the following is the correct way to find out the index of the second 's' in the string "She sells sea shells on the sea-shore"? A. String str = "She sells sea shells on the sea-shore"; int i; i = str.SecondIndexOf("s"); B. String str = "She sells sea shells on the sea-shore"; int i, j; i = str.FirstIndexOf("s"); j = str.IndexOf("s", i + 1); C. String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("s"); j = str.IndexOf("s", i + 1); D. String str = "She sells sea shells on the sea-shore"; int i, j; i = str.LastIndexOf("s"); j = str.IndexOf("s", i - 1); E. String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("S"); j = str.IndexOf("s", i);

C. String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("s"); j = str.IndexOf("s", i + 1);

What will be the output of the C#.NET code snippet given below? namespace IndiabixConsoleApplication { class SampleProgram { static void Main(string[ ] args) { string str= "Hello World!"; Console.WriteLine( String.Compare(str, "Hello World?" ).GetType() ); } } } A. 0 B. 1 C. String D. Hello World? E. System.Int32

E. System.Int32

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

E. The | operator can be used to put ON a bit.

If s1 and s2 are references to two strings, then which of the following is the correct way to compare the two references? A. s1 is s2 B. s1 = s2 C. s1 == s2 D. strcmp(s1, s2) E. s1.Equals(s2)

E. s1.Equals(s2)

A derived class can stop virtual inheritance by declaring an override as A. inherits B. extends C. inheritable D. not inheritable E. sealed

E. sealed

If a Student class has an indexed property which is used to store or retrieve values to/from an array of 5 integers, then which of the following are the correct ways to use this indexed property? 1. Student[3] = 34; 2. Student s = new Student(); s[3] = 34; 3. Student s = new Student(); Console.WriteLine(s[3]); 4. Console.WriteLine(Student[3]); 5. Student.this s = new Student.this(); s[3] = 34;

2, 3

If s1 and s2 are references to two strings then which of the following are the correct ways to find whether the contents of the two strings are equal? 1. if(s1 = s2) 2. if(s1 == s2) 3. int c; 4. c = s1.CompareTo(s2); 5. if( strcmp(s1, s2) ) 6. if (s1 is s2)

2, 3

Which of the following constitutes the .NET Framework? 1. ASP.NET Applications 2. CLR 3. Framework Class Library 4. WinForm Applications 5. Windows Services

2, 3

Which of the following security features can .NET applications avail? 1. PIN Security 2. Code Access Security 3. Role Based Security 4. Authentication Security 5. Biorhythm Security

2, 3

Which of the following snippets are the correct way to convert a Single into a String? 1. Single f = 9.8f; String s; s = (String) (f); 2. Single f = 9.8f; String s; s = Convert.ToString(f); 3. Single f = 9.8f; String s; s = f.ToString(); 4. Single f = 9.8f; String s; s = Clnt(f); 5. Single f = 9.8f; String s; s = CString(f);

2, 3

Which of the following is correct way to convert a String to an int? 1. String s = "123"; int i; i = (int)s; 2. String s = "123"; int i; i = int.Parse(s); 3. String s = "123"; int i; i = Int32.Parse(s); 4. String s = "123"; int i; i = Convert.ToInt32(s); 5. String s = "123"; int i; i = CInt(s);

2, 3, 4

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.

2, 3, 4

Which of the following statements are true about the C#.NET code snippet given below? String s1, s2; s1 = "Hi"; s2 = "Hi"; 1. String objects cannot be created without using new. 2. Only one object will get created. 3. s1 and s2 both will refer to the same object. 4. Two objects will get created, one pointed to by s1 and another pointed to bys2. 5. s1 and s2 are references to the same object.

2, 3, 5

Which of the following are the correct ways to increment the value of variable a by 1? 1. ++a++; 2. a += 1; 3. a ++ 1; 4. a = a +1; 5. a = +1;

2, 4

If Sample class has a Length property with get and set accessors then which of the following statements will work correctly? 1. Sample.Length = 20; 2. Sample m = new Sample(); m.Length = 10; 3. Console.WriteLine(Sample.Length); 4. Sample m = new Sample(); int len; len = m.Length; 5. Sample m = new Sample(); m.Length = m.Length + 20;

2, 4, 5

Which of the following statements are correct? 1. All operators in C#.NET can be overloaded. 2. We can use the new modifier to modify a nested type if the nested type is hiding another type. 3. In case of operator overloading all parameters must be of the different type than the class or struct that declares the operator. 4. Method overloading is used to create several methods with the same name that performs similar tasks on similar data types. 5. Operator overloading permits the use of symbols to represent computations for a type.

2, 5

Which of the following are valid .NET CLR JIT performance counters? 1. Total memory used for JIT compilation 2. Average memory used for JIT compilation 3. Number of methods that failed to compile with the standard JIT 4. Percentage of processor time spent performing JIT compilation 5. Percentage of memory currently dedicated for JIT compilation

3, 4

Which of the following statements are correct about the Bitwise & operator used in C#.NET? 1. The & operator can be used to Invert a bit. 2. The & operator can be used to put ON a bit. 3. The & operator can be used to put OFF a bit. 4. The & operator can be used to check whether a bit is ON. 5. The & operator can be used to check whether a bit is OFF.

3, 4, 5

Which of the following are NOT Relational operators in C#.NET? 1. >= 2. != 3. Not 4. <= 5. <>=

3, 5

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); } } } A. Bix1 method 123 Bixl method Bix2 method B. Bix1 method 123 Bix2 method C. Bix2 method 123 Bix2 method Bixl method D. Bixl method 123 E. Bix2 method 123 Bixl method

A. Bix1 method 123 Bixl method Bix2 method

Which of the following is the correct way to implement a read only property Length in a Sample class? A. class Sample { int len; public int Length { get { return len; } } } B. class Sample { public int Length { get { return Length; } } } C. class Sample { int len; public int Length { get { return len; } set { len = value; } } } D. class Sample { int len; public int Length { Readonly get { return len; } } }

A. class Sample { int len; public int Length { get { return len; } } }

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); A. public Sample() { i = 0; j = 0.0f; } public Sample (int ii, Single jj) { i = ii; j = jj; } B. public Sample (Optional int ii = 0, Optional Single jj = 0.0f) { i = ii; j = jj; } C. public Sample (int ii, Single jj) { i = ii; j = jj; } D. Sample s; E. s = new Sample();

A. public Sample() { i = 0; j = 0.0f; } public Sample (int ii, Single jj) { i = ii; j = jj; }

Which of the following is NOT an Arithmetic operator in C#.NET? A. ** B. + C. / D. % E. *

A. **

Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language? A. .NET class libraries B. Common Language Runtime C. Common Language Infrastructure D. Component Object Model E. Common Type System

A. .NET class libraries

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

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

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(); } } } A. Sample class Bix1 method B. Bix1 method C. Sample class D. Bix1 method Sample class E. Sample class Sample class

A. Sample class Bix1 method

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

A. System.Object

A property can be declared inside a class, struct, Interface. A. True B. False

A. True

The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable. A. True B. False

A. True

Which of the following statements is correct? A. When used as a modifier, the new keyword explicitly hides a member inherited from a base class. B. Operator overloading works in different ways for structures and classes. C. It is not necessary that all operator overloads are static methods of the class. D. The cast operator can be overloaded.

A. When used as a modifier, the new keyword explicitly hides a member inherited from a base class.

Is it possible for you to prevent an object from being created by using zero argument constructor? A. Yes B. No

A. Yes

Is it possible to invoke Garbage Collector explicitly? A. Yes B. No

A. Yes

Which of the following is NOT an Assignment operator in C#.NET? A. \= B. /= C. *= D. += E. %=

A. \=

Which of the following keyword is used to change the data and behavior of a base class by replacing a member of a base class with a new derived member? A. new B. base C. overloads D. override E. overridable

A. new

Which of the following benefits do we get on running managed code under CLR? 1. Type safety of the code running under CLR is assured. 2. It is ensured that an application would not access the memory that it is not authorized to access. 3. It launches separate process for every application running under it. 4. The resources are Garbage collected.

All of the above

Which of the following jobs are done by Common Language Runtime? 1. It provides core services such as memory management, thread management, and remoting. 2. It enforces strict type safety. 3. It provides Code Access Security. 4. It provides Garbage Collection Services.

All of the above

A property can be declared inside a namespace or a procedure. A. True B. False

B. False

Suppose a Student class has an indexed property. This property is used to set or retrieve values to/from an array of 5 integers called scores[]. We want the property to report "Invalid Index" message if the user attempts to exceed the bounds of the array. Which of the following is the correct way to implement this property? A. class Student { int[] scores = new int[5] {3, 2, 4,1, 5}; public int this[ int index ] { set { if (index < 5) scores[index] = value; else Console.WriteLine("Invalid Index"); } } } B. class Student { int[] scores = new int[5] {3, 2, 4, 1, 5}; public int this[ int index ] { get { if (index < 5) return scores[ index ]; else { Console.WriteLine("Invalid Index"); return 0; } } set { if (index < 5) scores[ index ] = value; else Console.WriteLine("Invalid Index"); } } } C. class Student { int[] scores = new int[5] {3, 2, 4, 1, 5}; public int this[ int index ] { get { if (index < 5) return scores[ index ]; else { Console.WriteLine("Invalid Index"); return 0; } } } } D. class Student { int[] scores = new int[5] {3, 2, 4, 1, 5}; public int this[ int index ] { get { if (index < 5) scores[ index ] = value; else { Console.WriteLine("Invalid Index"); } } set { if (index < 5) return scores[ index ]; else { Console.WriteLine("Invalid Index"); return 0; } } } }

B. class Student { int[] scores = new int[5] {3, 2, 4, 1, 5}; public int this[ int index ] { get { if (index < 5) return scores[ index ]; else { Console.WriteLine("Invalid Index"); return 0; } } set { if (index < 5) scores[ index ] = value; else Console.WriteLine("Invalid Index"); } } }

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? A. if ((n&16) == 16) Console.WriteLine("Third bit is ON"); B. if ((n&8) == 8) Console.WriteLine("Third bit is ON"); C. if ((n ! 8) == 8) Console.WriteLine("Third bit is ON"); D. if ((n ^ 8) == 8) Console.WriteLine("Third bit is ON"); E. if ((n ~ 8) == 8) Console. WriteLine("Third bit is ON");

B. if ((n&8) == 8) Console.WriteLine("Third bit is ON"); Explanation: byte myByte = 153; // In Binary = 10011001 byte n = 8; // In Binary = 00001000 (Here 1 is the 4th bit from right) Now perform logical AND operation (n & myByte) 10011001 00001000 --------- 00001000 Here result is other than 0, so evaluated to True. --------- If the result is true, then we can understand that 4th bit is ON of the given data myByte.

Which of the following will be the correct output for the C#.NET code snippet given below? String s1="Kicit"; Console.Write(s1.IndexOf('c') + " "); Console.Write(s1.Length); A. 3 6 B. 2 5 C. 3 5 D. 2 6 E. 3 7

B. 2 5

What will be the output of the C#.NET code snippet given below? int i, j = 1, k; for (i = 0; i < 5; i++) { k = j++ + ++j; Console.Write(k + " "); }

B. 4 8 12 16 20

Which of the following statements is correct about properties used in C#.NET? A. A property can simultaneously be read only or write only. B. A property can be either read only or write only. C. A write only property will have only get accessor. D. A write only property will always return a value.

B. A property can be either read only or write only.

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

B. A value 1 will be assigned to d.

Which of the following will be the correct output for the C#.NET code snippet given below? String s1 = "ALL MEN ARE CREATED EQUAL"; String s2; s2 = s1.Substring(12, 3); Console.WriteLine(s2); A. ARE B. CRE C. CR D. REA E. CREATED

B. CRE

If a class Student has an indexer, then which of the following is the correct way to declare this indexer to make the C#.NET code snippet given below work successfully? Student s = new Student(); s[1, 2] = 35; A. class Student { int[ ] a = new int[5, 5]; public property WriteOnly int this[int i, int j] { set { a[i, j] = value; } } } B. class Student { int[ , ] a = new int[5, 5]; public int property WriteOnly { set { a[i, j] = value; } } } C. class Student { int[ , ] a = new int[5, 5]; public int this[int i, int j] { set { a[i, j] = value; } } } D. class Student { int[ , ] a = new int[5, 5]; int i, j; public int this { set { a[i, j] = value; } } }

C. class Student { int[ , ] a = new int[5, 5]; public int this[int i, int j] { set { a[i, j] = value; } } }

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

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

What will be the output of the C#.NET code snippet given below? byte b1 = 0xAB; byte b2 = 0x99; byte temp; temp = (byte)~b2; Console.Write(temp + " "); temp = (byte)(b1 << b2); Console.Write (temp + " "); temp = (byte) (b2 >> 2); Console.WriteLine(temp);

C. 102 0 38

Which of the following statements are correct? 1. String is a value type. 2. String literals can contain any character literal including escape sequences. 3. The equality operators are defined to compare the values of string objects as well as references. 4. Attempting to access a character that is outside the bounds of the string results in an IndexOutOfRangeException. 5. The contents of a string object can be changed after the object is created.

C. 2, 4

What will be the output of the C#.NET code snippet given below? int a = 10, b = 20, c = 30; int res = a < b ? a < c ? c : a : b; Console.WriteLine(res); A. 10 B. 20 C. 30 D. Compile Error / Syntax Error

C. 30

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.

C. 4, 5

Which of the following is NOT a Bitwise operator in C#.NET? A. & B. | C. << D. ^ E. ~

C. <<

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

C. A constructor can be a static constructor.

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

C. Garbage Collector

Which of the following statements is correct about properties used in C#.NET? A. Every property must have a set accessor and a get accessor. B. Properties cannot be overloaded. C. Properties of a class are actually methods that work like data members. D. A property has to be either read only or a write only.

C. Properties of a class are actually methods that work like data members.

Which of the following assemblies can be stored in Global Assembly Cache? A. Private Assemblies B. Friend Assemblies C. Shared Assemblies D. Public Assemblies E. Protected Assemblies

C. Shared Assemblies

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

C. The ^ operator can be used to Invert a bit.

Which of the following statements is correct about the C#.NET code snippet given below? namespace IndiabixConsoleApplication { 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. Overloading works only in case of subroutines and not in case of functions. C. func() cannot be considered overloaded because: return value cannot be used to distinguish between two overloaded functions. D. The call to i = s1.func() will assign 1 to i. E. The call j = s1.func() will assign 2.4 to j.

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

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? A. n = n && HF7 B. n = n & 16 C. n = n & 0xF7 D. n = n & HexF7 E. n = n & 8

C. n = n & 0xF7

Which of the following keyword is used to overload user-defined types by defining static member functions? A. op B. opoverload C. operator D. operatoroverload E. udoperator

C. operator

Which of the following will be the correct output for the C#.NET code snippet given below? String s1 = "Nagpur"; String s2; s2 = s1.Insert(6, "Mumbai"); Console.WriteLine(s2); A. NagpuMumbair B. Nagpur Mumbai C. Mumbai D. Nagpur E. NagpurMumbai

E. NagpurMumbai

Which of the following is the correct way to implement a write only property Length in a Sample class? A. class Sample { public int Length { set { Length = value; } } } B. class Sample { int len; public int Length { get { return len; } set { len = value; } } } C. class Sample { int len; public int Length { WriteOnly set { len = value; } } } D. class Sample { int len; public int Length { set { len = value; } } }

D. class Sample { int len; public int Length { set { len = value; } } }

Which of the followings is the correct way to overload + operator? A. public sample operator + ( sample a, sample b ) B. public abstract operator + ( sample a, sample b) C. public abstract sample operator + (sample a, sample b ) D. public static sample operator + ( sample a, sample b ) E. All of the above

D. public static sample operator + ( sample a, sample b )

Which of the following will be the correct output for the C#.NET code snippet given below? String s1 = "Five Star"; String s2 = "FIVE STAR"; int c; c = s1.CompareTo(s2); Console.WriteLine(c); A. 0 B. 1 C. 2 D. -1 E. -2

D. -1

Which of the following statement is correct about a String in C#.NET? A. A String is mutable because it can be modified once it has been created. B. Methods of the String class can be used to modify the string. C. A number CANNOT be represented in the form of a String. D. A String has a zero-based index. E. The System.Array class is used to represent a string.

D. A String has a zero-based index.

A Student class has a property called rollNo and stu is a reference to a Student object and we want the statement stu.RollNo = 28 to fail. Which of the following options will ensure this functionality? A. Declare rollNo property with both get and set accessors. B. Declare rollNo property with only set accessor. C. Declare rollNo property with get, set and normal accessors. D. Declare rollNo property with only get accessor. E. None of the above

D. Declare rollNo property with only get accessor.

Which of the following statements is correct about constructors? A. If we provide a one-argument constructor then the compiler still provides a zero-argument constructor. B. Static constructors can use optional arguments. C. Overloaded constructors cannot use optional arguments. 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.

Code that targets the Common Language Runtime is known as A. Unmanaged B. Distributed C. Legacy D. Managed Code E. Native Code

D. Managed Code

Which of the following ways to create an object of the Sample class given below will work correctly? class Sample { int i; Single j; double k; public Sample (int ii, Single jj, double kk) { i = ii; j = jj; k = kk; } } A. Sample s1 = new Sample(); B. Sample s1 = new Sample(10); C. Sample s2 = new Sample(10, 1.2f); D. Sample s3 = new Sample(10, 1.2f, 2.4); E. Sample s1 = new Sample(, , 2.5);

D. Sample s3 = new Sample(10, 1.2f, 2.4);

Which of the following statements are correct about static functions? A. Static functions are invoked using objects of a class. B. Static functions can access static data as well as instance data. C. Static functions are outside the class scope. D. Static functions are invoked using class.

D. Static functions are invoked using class.

Which of the following statements is correct? A. Static methods can be a virtual method. B. Abstract methods can be a virtual method. C. It is necessary to override a virtual method. D. When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overriden. E. We can override virtual as well as non-virtual methods.

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

If Sample class has a Length property with set accessor then which of the following statements will work correctly? A. Sample m = new Sample(); int l; l = m.Length; B. Sample m = new Sample(); m.Length = m.Length + 20; C. Sample.Length = 20; D. Console.WriteLine (Sample.Length); E. Sample m = new Sample(); m.Length = 10;

E. Sample m = new Sample(); m.Length = 10;

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

E. 6.5 6.5

Which of the following statements about a String is correct? A. A String is created on the stack. B. Whether a String is created on the stack or the heap depends on the length of the String. C. A String is a primitive. D. A String can be created by using the statement String s1 = new String; E. A String is created on the heap.

E. A String is created on the heap.

Which of the following statements is correct about Managed Code? A. Managed code is the code that is compiled by the JIT compilers. B. Managed code is the code where resources are Garbage Collected. C. Managed code is the code that runs on top of Windows. D. Managed code is the code that is written to target the services of the CLR. E. 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.

Which of the following are parts of the .NET Framework? 1. The Common Language Runtime (CLR) 2. The Framework Class Libraries (FCL) 3. Microsoft Published Web Services 4. Applications deployed on IIS 5. Mobile Applications

Only 1, 2


Ensembles d'études connexes

Chapter 14 Benchmark Biology Test

View Set

Express, Implied, and Apparent Authorities

View Set

Geopolitical Vocabulary and Phrases

View Set

Chapter 31: Mechanisms of Endocrine Control Porth

View Set