0
Alien head

programming languages Online Quiz - 22

Description: programming languages Online Quiz - 22
Number of Questions: 20
Created by:
Tags: programming languages

What is an ArrayList?

  1. Class

  2. Interface

  3. Abstract Class

  4. All of the above

Answer: 1

What are the constructors of ArrayList?

  1. ArrayList( )

  2. ArrayList(Collection c)

  3. ArrayList(int capacity)

  4. All of the Above

Answer: 4

What is the Parent Class of ArraList?

  1. AbstractList

  2. List

  3. Array

  4. All of the Above

Answer: 1

What is difference between array & arraylist?

  1. Array: can store primitive ArrayList: Stores object only

  2. Array: fix size ArrayList: resizable

  3. Array: can have multi dimensional ArrayList: can have multi dimensional

  4. Array: lang ArrayList: Collection framework

Answer: 1,2,4

Which implementation of the List interface provides for the fastest insertion of a new element into the middle of the list?

  1. Vector

  2. Array List

  3. Linked List

  4. None of the above

Answer: 3

What is the List interface?

  1. The Set interface

  2. list stores elements in an ordered way but may contain duplicate elements

  3. List interface provides support for ordered collections of objects.

  4. All of the above

Answer: 3

What is an Iterator ?

  1. Enables you to cycle through a collection in the forward direction only, for obtaining or removing elements

  2. just for loop

  3. while loop

  4. It is an class for storing objects

Answer: 1

Given: • d is a valid, non-null Date object • df is a valid, non-null DateFormat object set to the current locale What outputs the current locales country name and the appropriate version of d’s date?

  1. Locale loc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ “ “+ df.format(d));

  2. Locale loc = Locale.getDefault();System.out.println(loc.getDisplayCountry()+ “ “ + df.format(d));

  3. Locale bc = Locale.getLocale();System.out.println(loc.getDisplayCountry()+ “ “+ df.setDateFormat(d));

  4. Locale loc = Locale.getDefault();System.out.println(loc.getDispbayCountry()+ “ “+ df.setDateFormat(d));

Answer: 2

Which of the following represent legal flow control statements? (A) break; (B) break(); (C) continue outer; (D) continue(inner); (E) return; (F) exit();

  1. (A), (B) & (C)

  2. (A), (C) & (E)

  3. (A), (C) & (D)

  4. (A) & (E)

  5. (C) & (E)

Answer: 2

Given the declarations boolean b; short x1 = 100, x2 = 200, x3 = 300; Which of the following statements are evaluated to true? (A) b = x1 * 2 == x2; (B) b = x1 + x2 != 3 * x1; (C) b = (x3 - 2*x2<0) || ((x3 = 400)<2*x2); (D) b = (x3 - 2*x2>0) || ((x3 = 400) 2x2);

  1. (A), (B) & (C)

  2. (A), (C) & (D)

  3. (B) & (C)

  4. (A) & (C)

  5. (A) & (D)

Answer: 4

In the code below, what data types the variable x can have? byte b1 = 5; byte b2 = 10; x = b1 * b2;(A) byte (B) int (C) short (D) long (E) float (F) double

  1. (A), (B), (D) & (E)

  2. (B), (C) & (D)

  3. (B), (D), (E) & (F)

  4. (B), (D) & (E)

  5. (D) & (F)

Answer: 3

Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what will be the values of x, y and z?

  1. x = 4, y = 1, z = 5

  2. x = 3, y = 2, z = 6

  3. x = -7, y = 1, z = 5

  4. x = 4, y = 2, z = 6

Answer: 2

"typedefs" used for data types are not machine dependent.

  1. True

  2. False

Answer: 2

"typedefs" used for data types are not machine dependent.

  1. True

  2. False

Answer: 2

Why we use "Type Def" in C ?

  1. Modifying existing Data type.

  2. Used for defining type of data type used.

  3. Creating new data type names

  4. Not a valid key word

Answer: 1

SQL was developed by

  1. Donald D. Chamberlin and Raymond F. Boyce

  2. Donald D. Chamberlin

  3. Raymond F. Boyce

  4. none

Answer: 1

Amoeba operating system was developed by

  1. Linus Torvalds

  2. Dennis Ritchie

  3. Sun Microsystems

  4. Andrew S. Tanenbaum

Answer: 4

Commonly used metasyntactic variable names are

  1. Hello and world

  2. Foo and Bar

  3. i and j

  4. int and float

Answer: 2

Java is a programming language originally developed by

  1. Dennis Ritchie

  2. Edsger Dijkstra

  3. James Gosling

  4. Louis Pasteur

Answer: 3

class H { public static void main (String[] args) { String s1 = "HHH"; StringBuffer sb2 = new StringBuffer(s1); System.out.print(sb2.equals(s1) + "," + s1.equals(sb2)); }}

  1. Prints: false,false

  2. Prints: true,false

  3. Prints: false,true

  4. Prints: true,true

  5. None of the above

Answer: 1
+ View questions