0

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

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

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

A variable which is declared inside a method is called a________variable

  1. Serial

  2. Local

  3. Private

  4. Static


Correct Option: B

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
  1. It contain instance variables

  2. It contain constructors

  3. It may extend another class

  4. All of the these


Correct Option: D
  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
  1. No return type for events

  2. Double

  3. Integer

  4. String


Correct Option: A
  1. System.Int8

  2. System.Int16

  3. System.Int32

  4. System.Int64


Correct Option: C
  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

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

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

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
  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
- Hide questions