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

A ( hypothetical ;) ) graphics program uses the following structure to represet a 3d point struct point3d { int x; int y; int z; // X,y,z represent the three cooddinates of a 3d point in space }; A function was written to calculate the distace between two point3d objects. void func(point3d pt1,point3d pt2) { // Calculate the distance ..... } say at run time 2 million point3d struct objects were created and the above mentioned function was called say 1 million times. Calling the above mentioned function will result in a performance hit because

  1. The point3d is represented as struct . change it to a class and it will run better

  2. The point3d struct is not byte aligned.

  3. The in the function point3d struct parameters are passed by value, Which will cause additional overhead.

  4. The point3d struct has 3 members of type int . Change it to short ,the program will run faster.

Correct Option: C

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

class B1{ public B1(){ System.out.println("B"); } } class A1 extends B1{ void A1(){ System.out.println("A"); } } public class Test { public static void main(String[] args){ B1 a = new A1(); } } what will be output?

  1. A

  2. B

  3. BA

  4. AB

Correct Option: B

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