0

programming languages Online Quiz - 254

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

Which of the following statements are true about synchronization? choose two

  1. Static methods cannot be synchronized

  2. Synchronized methods cannot make calls to non-synchronized methods

  3. A synchronized method can be overridden to be non-synchronized and vice versa

  4. When a thread is executing a synchronized method, other threads can freely access non-synchronized methods of the same object


Correct Option: C,D
  1. n = n->next; free( n );

  2. struct node m = n; n = n->next; free( m );

  3. free( n ); n = n->next;

  4. struct node m = n; free( m ); n = n->next;


Correct Option: B

int n = 0; for ( ; ; ) { if (n++ == 5) break; continue; } printf("x=%d\n", x); What will be printed when the sample code above is executed?

  1. 1

  2. 2

  3. 4

  4. 6


Correct Option: D

struct customer *p= malloc( sizeof( struct customer ) ); Given the sample allocation for the pointer "p" found above, which one of the following statements is used to reallocate ptr to be an array of 10 elements?

  1. p = realloc( ptr, 10 * sizeof( struct ritesh));

  2. realloc( ptr, 9 * sizeof( struct ritesh) );

  3. p+= malloc( 9 * sizeof( struct ritesh) );

  4. p = realloc( ptr, 9 * sizeof( struct ritesh) );


Correct Option: A
  1. int *p; *p = 0x200;

  2. int *p = &0x200;

  3. int *p = *0x200;

  4. int *p = 0x200;


Correct Option: A

Socket – based communication is programming language independent.

  1. True

  2. False


Correct Option: A
  1. Server in java.net package

  2. ServerSocket in java.util.package

  3. Server in java.util package

  4. ServerSocket in java.net package


Correct Option: D

If a client is run, when the server is not up

  1. Null Pointer Exception at client side

  2. Client will receive warning message

  3. ConnectException is thrown

  4. Compilation Error


Correct Option: C

The assigned port at the server can be obtained in the client side by

  1. getLocalPort() method

  2. getActivePort() method

  3. By pinging the server

  4. By giving value 0 as port number


Correct Option: A

Which one of the following is not marker interface?

  1. Serializable

  2. Remote

  3. Cloneable

  4. List


Correct Option: D

Which algorithm is used in thread scheduling?

  1. Fixed Priority

  2. Round Robin

  3. Discrete Optimization

  4. None of the above


Correct Option: A

Which modifier tells JVM to avoid object persistence during serialization?

  1. final

  2. transient

  3. public

  4. private


Correct Option: B

What is the super class of Hashtable?

  1. Map

  2. HashMap

  3. Dictionary

  4. Vector


Correct Option: C

Which of the following does not guarantee the order of data storage will be constant over a period of time?

  1. HashMap

  2. ArrayList

  3. Stack

  4. Queue


Correct Option: A

Iterator for a collection will update along with the collection, when it is modified and give the updated one while traversing.

  1. True

  2. False


Correct Option: B

What is the result of compiling and running the following code ? 1. StringBuffer s1=new StringBuffer("hello"); 2. StringBuffer s2=new StringBuffer("hello"); 3. Float f1=9.0F; 4. Double f2=9.0; 5. System.out.print(f1.equals(f2)); 6. System.out.print(s1==s2); 7. System.out.print(s1.equals(s2));

  1. Prints "truetruetrue"

  2. Prints "falsefalsetrue"

  3. Prints "falsefalsefalse"

  4. Compiler error on line 5

  5. Compiler error on line 7

  6. None


Correct Option: B
- Hide questions