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

char * Name[] = { "Ritesh", "Kumar" "Singh", "Happy", "Bittoo" "Roshan", "Go", }; How many elements does the array dwarves (declared above) contain?

  1. 4

  2. 5

  3. 6

  4. 7


Correct Option: B
  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
  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

Which one of the following will declare a pointer to an integer at address 0x100 in memory?

  1. int *p; *p = 0x200;

  2. int *p = &0x200;

  3. int *p = *0x200;

  4. int *p = 0x200;


Correct Option: A

Sockets provide an interface for programming networks in which layer?

  1. Application

  2. Network

  3. Transport

  4. Physical


Correct Option: C

Socket – based communication is programming language independent.

  1. True

  2. False


Correct Option: A

Using which class,A server can be implemented?

  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
  1. Null Pointer Exception at client side

  2. Client will receive warning message

  3. ConnectException is thrown

  4. Compilation Error


Correct Option: C
  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
  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

Main is the only thread that runs when a Java program is started?

  1. True

  2. False


Correct Option: B

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