0
Alien head

programming languages Online Quiz - 25

Description: programming languages Online Quiz - 25
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

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


Correct Option: A

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


Correct Option: A

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


Correct Option: D

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


Correct Option: D

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


Correct Option: C

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


Correct Option: A

int keyword targets to which .Net type?

  1. System.Int8

  2. System.Int16

  3. System.Int32

  4. System.Int64


Correct Option: C

An Event has _____ as default return type?

  1. No return type for events

  2. Double

  3. Integer

  4. String


Correct Option: A

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


Correct Option: A

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


Correct Option: D

Sealed Classes cannot be a base class?

  1. True

  2. False


Correct Option: A

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


Correct Option: D

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


Correct Option: A

Two methods with the same name but with different parameters?

  1. Overloading

  2. Overriding

  3. Overridable

  4. Duplexing


Correct Option: A

A variable which is declared inside a method is called a________variable

  1. Serial

  2. Local

  3. Private

  4. Static


Correct Option: B

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


Correct Option: A

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


Correct Option: A

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


Correct Option: A

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


Correct Option: A

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


Correct Option: A
+ View questions