0
Alien head

programming languages Online Quiz - 25

Description: programming languages Online Quiz - 25
Number of Questions: 20
Created by:
Tags: programming languages

What is the .NET collection class that allows an element to be accessed using a unique key?

  1. HashTable

  2. ArrayList

  3. SortedList

  4. All of above

Answer: 1

What is accessibility modifier “protected internal”?

  1. It is available to classes that are within the same assembly and derived from the specified base class.

  2. It is available within the class definition

  3. It is the most permissive access level

  4. It is the least permissive access level

Answer: 1

Which of the following is incorrect about System.Text.StringBuilder and System.String?

  1. StringBuilder is more efficient when there is a large amount of string manipulation

  2. Strings are immutable, so each time a string is changed, a new instance in memory is created.

  3. StringBuilder is mutable; when you modify an instance of the StringBuilder class, you modify the actual string, not a copy

  4. Strings are mutable in .Net

Answer: 4

Different ways a method can be overloaded in C#.NET?

  1. Different parameter data types

  2. Different number of parameters

  3. Different order of parameters

  4. All of these

Answer: 4

Boxing in .Net allows the user to convert?

  1. a interger type to double

  2. a reference type to a value type

  3. a value type to a reference type

  4. a double type to interger

Answer: 3

Difference between Convert.ToString() and ToString()

  1. Convert.ToString() handle null values but ToString() don't

  2. ToString() output as per format supplied

  3. Convert.ToString() only handle null values

  4. ToString() handle null values but Convert.ToString() don't

Answer: 1

int keyword targets to which .Net type?

  1. System.Int8

  2. System.Int16

  3. System.Int32

  4. System.Int64

Answer: 3

An Event has _____ as default return type?

  1. No return type for events

  2. Double

  3. Integer

  4. String

Answer: 1

Features of Read only variables?

  1. It is allocated at compile time

  2. Declaration and initialization is separated

  3. It is allocated at runtime

  4. All of these

Answer: 1

What are the features of an abstract class?

  1. It contain instance variables

  2. It contain constructors

  3. It may extend another class

  4. All of the these

Answer: 4

Sealed Classes cannot be a base class?

  1. True

  2. False

Answer: 1

If a class is using an interface....

  1. it must inherit the properties of the interface

  2. contain the same methods as the interface

  3. create an interface object

  4. all of the above

Answer: 4

Is there any errors in this -> EmployeeMgmt constructor: Public int EmployeeMgmt { emp_id = 100; }

  1. Return type

  2. No errors

  3. Formal parameters

  4. Name

Answer: 1

Two methods with the same name but with different parameters?

  1. Overloading

  2. Overriding

  3. Overridable

  4. Duplexing

Answer: 1

A variable which is declared inside a method is called a________variable

  1. Serial

  2. Local

  3. Private

  4. Static

Answer: 2

What is the output for the below code ? public class Test { public static void main(String... args) throws Exception { Integer i = 34; int l = 34; if(i.equals(l)){ System.out.println(true); }else{ System.out.println(false); } } }

  1. true

  2. false

  3. Compile Error

  4. Runtime Exception

Answer: 1

What is the output for the below code ? class A { { System.out.print("b1 "); } public A() { System.out.print("b2 "); } } class B extends A { static { System.out.print("r1 "); } public B() { System.out.print("r2 "); } { System.out.print("r3 "); } static { System.out.print("r4 "); } } class C extends B { public static void main(String[] args) { System.out.print("pre "); new C(); System.out.println("post "); } }

  1. r1 r4 pre b1 b2 r3 r2 post

  2. r1 r4 pre b1 b2 post

  3. r1 r4 pre b1 b2 post r3 r2

  4. pre r1 r4 b1 b2 r2 r3 post

Answer: 1

What is the output for the below code ? public class Test { static { int a = 5; } public static void main(String[] args){ System.out.println(a); } }

  1. Compile with error

  2. 5

  3. 0

  4. Runtime Exception

Answer: 1

What is the output for the below code ? public interface TestInf { int i =10; } public class Test { public static void main(String... args) { TestInf.i=12; System.out.println(TestInf.i); } }

  1. Compile with error

  2. 10

  3. 12

  4. Runtime Exception

Answer: 1

public class Test { public static void main(String... args) { for(int i = 2; i < 4; i++) for(int j = 2; j < 4; j++) if(i < j) assert i!=j : i; } }

  1. The class compiles and runs, but does not print anything

  2. The number 2 gets printed with AssertionError

  3. The number 3 gets printed with AssertionError

  4. compile error

Answer: 1
+ View questions