programming languages Online Quiz - 168

Description: programming languages Online Quiz - 168
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. It is just a fancy keyword, No purpose here

  2. Prevents the compiler from assigning the function as an rvalue

  3. Prevents the compiler from assigning the function as an lvalue

  4. It makes sure that the return value is a const and is not changed by anyone else

Correct Option: C

A friend of mine once wrote a function as follows. int * func() { int i; for (int k=0;k<200;k++) //Do something here .... return &i; } I think it is faulty . What is wrong here?

  1. Nothing is wrong. You are wrong.

  2. Loops are not allowed inside the function scope, Since it degrades performance

  3. My friend tried to return a pointer to a local function variable , which is invalid once the function call compltes.

  4. The value i is not properly initialised, SO it may contain some garbage .

Correct Option: C

I want to declare a pointer to a constant int variable ,pointing to a constant memory location. What is the syntax?

  1. const int* ptr

  2. const* int ptr

  3. There is no such declaration like that

  4. const int* const ptr

Correct Option: D

consider the following line in the c++ code extern "C" { f1(); f2();... } The purpose of the extern keyword is

  1. They tell the C++ compiler that they are functions compiled by a C compiler , So that they can be used in C++

  2. they mean that the function are declared somewhere and defined somewhere

  3. They improve performance

  4. They are used with extern variables.

Correct Option: A

public static void main(String[] args){ Integer i = new Integer(5); List myList; myList = new ArrayList(); myList.add(3); myList.add(5); myList.add(7); myList.remove(i); for(String s: myList) { System.out.println("List Value >> "+s); } } What is the output?

  1. 3,7

  2. 3,5,7

  3. index Outofbound exception

  4. Compilation fails

Correct Option: D

class A{ public void _a(){ System.out.println("A"); } } class B extends A{ public void _a(){ System.out.println("B"); } } public class InheritanceTest { public static void main(String[] args){ A aa = new B(); System.out.println(aa._a()); } } What is the output?

  1. B

  2. A

  3. Compilation fails

  4. none of these

Correct Option: C

public class SwitchTest { public static void main(String[] args) { Boolean b = Boolean.TRUE; switch(b) { case(true): System.out.println("A"); case(false): System.out.println("B"); case(3): System.out.println("C"); } } } output?

  1. A

  2. ABC

  3. comilation fails

  4. AB

Correct Option: C
  1. jsp:forward

  2. jsp:getBean

  3. jsp:param

  4. jsp:getProperty

Correct Option: B
  1. Hashtable.

  2. ListDictionary.

  3. Hybrid Dictionary.

  4. NameValueCollection.

  5. StringDictionary.

Correct Option: E
  1. TRUE.

  2. FALSE

  3. Cant say.

  4. Depends on the valuetype used.

Correct Option: B

Constants cannot be marked with which of the below keywords

  1. Public.

  2. Private.

  3. Protected.

  4. static.

  5. Internal.

  6. ProtectedInternal.

Correct Option: D
  1. A method without code

  2. A method which is called when an event is triggered.

  3. A method which doesnot contain code.

  4. A reference to a method which itself doesnot contain code.

Correct Option: D
  1. BinaryFormatter and SOAPFormatter

  2. BinaryFormatter and XmlSerializer

  3. XmlSerializer.

  4. BinaryFormatter , SOAP Formatter, XmlSerializer

Correct Option: A
  1. After serialization is complete

  2. Before deserialization

  3. After Deserialization is complete

  4. To be called explicitly after serialization

  5. To be called explicitly after Deserialization.

Correct Option: C
- Hide questions