0
Alien head

programming languages Online Quiz - 140

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

What is the problem,if any in the following code: struct Sample { int a; Sample() { a=0; } }; class Sample2:public Sample { }; struct Sample3:protected Sample2{};

  1. nothing wrong will complie fine.

  2. class cannot inherit from struct

  3. struct cannot inherit from class

  4. struct cannot have constructor


Correct Option: A

Which of the following operators cannot be overloaded?

  1. ~

  2. .*

  3. &

  4. ->*


Correct Option: B

Which of the following describes the correct syntax for overloading new operator for arrays

  1. new operator cannot be overloaded

  2. void *operator new(size_t,int);

  3. void operator new;

  4. void *operator new;


Correct Option: D

static keyword can be used with virtual functions.

  1. True

  2. False


Correct Option: A

What will be the output of the following code: main() { int a=10,b=20; a=a^b; b=a^b; a=a^b; cout<

  1. 20,10

  2. 10,20

  3. 1,10

  4. 20,2


Correct Option: A

Which of the following signifies implementation inheritance?

  1. Public Inheritance

  2. Protected Inheritance

  3. Private Inheritance

  4. Virtual Inheritance


Correct Option: C

In the above code, the call to the factorial() throws StackOverflowException. Will the finally block gets executed and prints the "finally" message to the user?

  1. Yes

  2. No

  3. May be

  4. I don't know


Correct Option: B

Can we invoke the garbage collector explicitly?

  1. Yes, but the actual collection is not deterministic

  2. No.

  3. Yes, and the actual collection is deterministic

  4. I don't know.


Correct Option: C

What is the difference between the S.ToString() and Convert.ToString(S) in the given scenario?

  1. No difference

  2. S.ToString() handles null values

  3. Convert.ToString(S) handles null values

  4. I don't know.


Correct Option: C

How can we prevent a class from Instantiating?

  1. Use Abstract class

  2. Use Private Constructor

  3. Both of the above

  4. Use Sealed class


Correct Option: C

For the C# Compiler (csc.exe), which option is the default output type among the given Output options ?

  1. /target:library

  2. /target:module

  3. /target:exe

  4. /target:winexe


Correct Option: C

Which of the following statements correctly declares a 2 dimensional array in c#?

  1. int[,] myarray;

  2. int[][] myarray;

  3. int myarray[,];

  4. int[2] myarray;


Correct Option: A

Are private class-level variables inherited?

  1. No, and they are not accessible

  2. Yes, but they are not accessible

  3. May be

  4. I don't know.


Correct Option: B

Can Abstarct class have a constructor?

  1. Yes, Only Concrete constructor

  2. Yes, Only Abstract constructor.

  3. No

  4. I don't know.


Correct Option: A

What’s the .NET datatype that allows the retrieval of data by a unique key?

  1. NamedValueCollection

  2. HashTable

  3. SortedList

  4. I don't know


Correct Option: B

If a class has a Static Constructor and a Public Constructor,Which one is invoked first upon object initialization?

  1. public constructor

  2. static constructor

  3. both

  4. I don't know.


Correct Option: B

A transient variable may be serialized.

  1. True

  2. False


Correct Option: B

The java.lang package is always imported by default.

  1. True

  2. False


Correct Option: A

true and false are keywords in JAVA

  1. True

  2. False


Correct Option: B

A garbage collected object can be reached again.

  1. True

  2. False


Correct Option: B
+ View questions