C# and Java Programming Concepts

Test your knowledge of C# and Java programming fundamentals including generics, delegates, structures, value/reference types, interfaces, exceptions, threading, and string handling.

20 Questions Published

Questions

Question 1 True/False

Is sizeof a keyword?

  1. True
  2. False
Question 2 True/False

Static method accecss non-static field or call non-static method (T/F)

  1. True
  2. False
Question 3 Multiple Choice (Multiple Answers)

What methods java providing for Thread communications

  1. Wait
  2. notify
  3. notifyAll
  4. Sleep
Question 4 True/False

IOexception is a unchecked exception (T/F)

  1. True
  2. False
Question 5 True/False

These classes are defined in separate files. Will this code compile successfully? package dir1; class Parent { public java.util.Set set; } package dir2; class Child extends dir1.Parent { void test() { set.add("Hello"); } }

  1. True
  2. False
Question 6 Multiple Choice (Multiple Answers)

For concatenation of strings, which method is good, StringBuffer or String

  1. String
  2. StringBuffer
  3. Both
  4. None
Question 7 Multiple Choice (Single Answer)

For concatenation of strings, which method is good, StringBuffer or String

  1. String Buffer
  2. String
  3. both
  4. none
Question 8 Multiple Choice (Single Answer)

The following are used for Thread communication

  1. wait,notify,notifyall
  2. wait,notify,notifyall,sleep
  3. Yield,sleep
  4. yield, sleep, wait
Question 9 Multiple Choice (Single Answer)

Java provide ______ construct to find out the size of an object

  1. sizeOf ()
  2. size()
  3. getSize()
  4. No such method in java to find size of an object directly.
Question 10 Multiple Choice (Single Answer)

modifiers that allowed for methods in an Interface

  1. public, abstract
  2. abstract, final
  3. final
  4. public
Question 11 Multiple Choice (Single Answer)

What is "delete" in java?

  1. a Keyword
  2. a method
  3. a special identifier
  4. none
Question 12 Multiple Choice (Single Answer)

Differences between Value types and Reference types

  1. Value type variables are stored on stack. Reference type variables are stored on heap.
  2. Value type holds the data directly, Reference type points to the location that holds the data.
  3. Value type cannot contain null value. Reference type can contain null value.
  4. A new type cannot be derived from value type. A new type can be derived from reference type.
  5. All of the above
Question 13 Multiple Choice (Single Answer)

Which of the following is value type

  1. string
  2. class
  3. delegate
  4. struct
  5. interface
Question 14 Multiple Choice (Single Answer)

what is the difference between indexer and property

  1. An indexer is always an instance member, but a property can be static also.
  2. A property is always an instance member, but An indexer can be static also.
  3. Indexers can not be participate in inheritance, properties can also participate in inheritance
  4. No difference
Question 15 True/False

Abstract methods should override in non abstract child class. If the child class is also abstract class then abstract methods overriding is not mandatory.

  1. True
  2. False
Question 16 Multiple Choice (Multiple Answers)

Structure

  1. Structures can be used as a base for other structures.
  2. A structure can implement one or more interfaces.
  3. Structure members can be methods, fields, indexers, properties, operator methods, and events.
  4. Structures can also define constructors, but not destructors. And you cannot define a default (parameterless) constructor for a structure.
Question 17 Multiple Choice (Multiple Answers)

Generic Constraints

  1. Can not use in structs
  2. A derivation constraint
  3. A default constructor constraint
  4. A reference/value type constraint
Question 18 True/False

C# allows you to define static methods that use generic type parameters

  1. True
  2. False
Question 19 True/False

A delegate defined in a class can take advantage of the generic type parameter of that class

  1. True
  2. False
Question 20 True/False

.NET allows you to have serializable generic types

  1. True
  2. False