0

programming languages Online Quiz - 321

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

Perl has

  1. 8 data types

  2. 7 data types

  3. 16 data types

  4. No special data types


Correct Option: D

Scalar Variable in perl is preceded by a

  1. $

  2. #

  3. @

  4. None of the above


Correct Option: A

A Hash variable in perl is preceded by a

  1. $

  2. %

  3. #

  4. @


Correct Option: B

What are the functions used to add elements in an array

  1. Push and unshift

  2. Push and shift

  3. Pop and push

  4. Shift and unshift


Correct Option: A

Which function is used to remove a key – value pair from hash

  1. Remove

  2. Unhash

  3. Delete

  4. Rub


Correct Option: C

PERL is an acronym of

  1. Powerful Encryption and Report Language

  2. Practical Extraction and Report Language

  3. Practical Emotional and Rational Language

  4. Powerful Execution and Riding Language


Correct Option: B

Select two methods that correctly overload the following method? (Assume that all necessary packages have been imported). byte bMethod(short i) throws Exception {...}

  1. int bMethod(int i) throws IOException{...}

  2. protected int bMethod(short s) throws FileNotFoundException{...}

  3. private String aMethod(byte b,short s) throws Exception{...}

  4. char bMethod(String s) throws RuntimeException{...}

  5. int bMethod(short sh){...}


Correct Option: A,D

Which of the following statements are infinite loops? Select two correct answers

  1. for(int i=10;i>0;i-=-2);

  2. for(int i=0;i<012;i=i++);

  3. for(int i=0;i<0;i--);

  4. for(int i=0;(i++^--i)==0;i++);

  5. for(int i=010;i==10;i+=0);


Correct Option: B,D

Select two methods that correctly override the following method? (Assume that all necessary packages have been imported). protected int aMethod(int i) throws IOException {...}

  1. int aMethod(int i) throws IOException{...}

  2. protected int aMethod(int i) throws FileNotFoundException{...}

  3. public int aMethod(int i) throws Exception{...}

  4. public int aMethod(byte i) throws IOException{...}

  5. protected int aMethod(int i) throws IOException,FileNotFoundException{...}


Correct Option: B,E

Select three correct statements.

  1. A static method may override another static method.

  2. A static method cannot override a non-static method.

  3. A non-static method cannot override a static method.

  4. A non-static method may be overloaded by a static method.

  5. A synchronized method cannot be overridden.


Correct Option: B,C,D

Command to execute a compiled java programs is

  1. run

  2. execute

  3. javac

  4. java


Correct Option: D

Which of the following denote methods of HttpServlet class?

  1. doGet()

  2. doTrace()

  3. doOptions()

  4. All the Above


Correct Option: D

Which of the following helps in garbage collection?

  1. final

  2. finally

  3. finalize

  4. finalizer


Correct Option: C

What is the output of the following code? import java.util.*; public class Example { final Vector v; public Example() { } }

  1. The above code will not compile, Vector v is not initialized.

  2. The above code will compile and throw a Runtime Exception

  3. The above code will compile and not throw any Exception during runtime. V is initialized to null

  4. None of the Above.


Correct Option: A

What does the following expression return? Math.max(Float.POSITIVE_INFINITY,Double.POSITIVE_INFINITY);

  1. Float.POSITIVE_INFINITY

  2. Double.POSITIVE_INFINITY

  3. runtime Exception

  4. None of the Above


Correct Option: B

The class that inherits is called a

  1. superclass

  2. subclass

  3. instance class

  4. None of the Above


Correct Option: B

The process of writing the state of an object to a byte stream is called as

  1. Deserialization

  2. Serialization

  3. Interface

  4. None


Correct Option: B

What is the output of the following piece of code? if(" String ".trim() == "String") System.out.println("Welcome"); else System.out.println("Good Bye");

  1. The code will compile and print "Welcome"

  2. The code will compile and print "Good Bye"

  3. The code will cause a compiler error

  4. None of the Above


Correct Option: B

What is the number of bytes used by Java primitive long?

  1. The number of bytes is compiler dependent

  2. 2

  3. 4

  4. 8


Correct Option: D

AI Explanation

To answer this question, we need to understand the size of the Java primitive data type "long."

The Java primitive data type "long" is a 64-bit signed integer. It can hold values ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

In Java, the size of a "long" data type is always 8 bytes. This is because the Java language specification defines "long" as a 64-bit data type, which means it requires 8 bytes of memory to store its value.

Therefore, the correct answer is:

D. 8

- Hide questions