[QCM] – Création et utilisation de types

publicitemcppreparation

 

Nombre de questions disponibles : 21

QUESTION NO: 1

You are running a training exercise for junior developers. You are currently discussing the use of the Queue <T> collection type.

Which of the following is TRUE with regards to the Queue <T>collection type?

  1. It represents a first in, first out (FIFO) collection of objects.
  2. It represents a last in, first out (LIFO) collection of objects.
  3. It represents a collection of key/value pairs that are sorted by key based on the associated IComparer<T> implementation.
  4. It represents a list of objects that can be accessed by index.

Answer: 1

QUESTION NO: 2

 You have received instructions to create a custom collection. Objects in the collection must be processed via a foreach loop.

Which of the following is TRUE with regards to the required code?

  1. The code should implement the ICollection interface.
  2. The code should implement the IComparer interface.
  3. The code should implement the IEnumerable interface.
  4. The code should implement the IEnumerator interface.

 Answer: 3

QUESTION NO: 3

You are running a training exercise for junior developers. You are currently discussing the use of the Private access modifier to specify the declared accessibility of a member or a type.

Which of the following is TRUE with regards to the Private access modifier?

  1. It only allows access to the containing class or types derived from the containing class.
  2. It only allows access to the current assembly.
  3. It only allows access to the current assembly or types derived from the containing class.
  4. It only allows access to the containing type.
  5. It allows unrestricted.

 Answer: 4

QUESTION NO: 4

You have been tasked with creating an application that manages product data. You have written the code shown below:

Public static void Save<T>(T target) where T : Product

{

}

Which of the following is TRUE with regards to this code? (Choose all that apply.)

  1. It allows for the Save() method to be strongly typed.
  2. It prevents the Save() method from being strongly typed.
  3. It allows all types regardless of inheritance.
  4. It only allows types inherited from the Product class that makes use of a constructor that accepts no parameters.

Answer: 1,4

QUESTION NO: 5

You have been tasked with creating an application for ABC.com. The written code includes a sealed class.

Which of the following is TRUE with regards to sealed classes? (Choose all that apply.)

  1. It cannot be instantiated.
  2. It cannot be used as a base class.
  3. It provides a common definition of a base class that multiple derived classes can share.
  4. It is used to prevent derivation.

 Answer: 2,4

QUESTION NO: 6

 You are running a training exercise for junior developers. You are currently discussing iterators.

Which of the following is TRUE with regards to iterators?

  1. It represents code in a tree-like data structure, where each node is an expression.
  2. It can be used to step through collections such as lists and arrays.
  3. It provides a more flexible way to work with groups of objects.
  4. It is the process of converting an object into a stream of bytes in order to store the object

 Answer: 2

QUESTION NO: 7

You have received instructions to develop a class, named Customer, which exposes a string property, named CustomerType. You have been informed that your code should allow for the property to be accessible and customizable via code inside the Customer class or inside a class derived from the Customer class.

Which of the following actions should you take?

  1. You should consider including the Protected access modifier in your code.
  2. You should consider including the Protected Internal access modifier in your code.
  3. You should consider including the Public access modifier in your code.
  4. You should consider including the Private access modifier in your code.

 Answer: 1

QUESTION NO: 8

You are in the process of creating a new ABC.com application. You have written code that includes the Console.Readline method.

Which of the following is TRUE with regards to the Console.Readline method?

  1. It reads the next line of characters from the standard input stream.
  2. It reads the next character from the standard input stream.
  3. It reads the next line of characters from the customized input stream.
  4. It reads the next character from the customized input stream.

 Answer: 1

QUESTION NO: 9

 You are in the process of creating a new ABC.com application. You have written code that includes the Throw statement.

Which of the following is TRUE with regards to the Throw statement?

  1. It contains a try block followed by one or more catch clauses
  2. It is beneficial for cleaning up any resources that are allocated in the try block
  3. It is used to signal the occurrence of an atypical situation during the programs execution.
  4. It is used to obtain and use resources in a try block.

 Answer: 3

QUESTION NO: 10

 You are running a training exercise for junior developers. You are currently discussing the reason for adding the lockObject private object to a class.

Which of the following best describes this reason?

  1. To allow multiple threads access to the object.
  2. To allow only a single thread access to the object at a time.
  3. To make sure that when a single thread attempts to access the object, a deadlock occurs.
  4. To prevent any thread from accessing the object.

 Answer: 2

QUESTION NO: 11

You have written code that includes a statement that consists of a try block followed by one or more catch clauses.

Which of the following is the statement being used?

  1. The throw statement.
  2. The try-catch-finally statement.
  3. The try-finally statement.
  4. The try-catch statement.

 Answer: 4

QUESTION NO: 12

The code must allow for certain string input data to be validated via the Regex class.

Which of the following is TRUE with regards to the Regex class?

  1. It represents the results from a single successful subexpression capture.
  2. It represents the results from a single capturing group.
  3. It represents the results from a single regular expression match.
  4. It represents an absolute regular expression.

 Answer: 4

QUESTION NO: 13

The code includes a conditional directive that starts with a #if directive.

You want to make sure that the conditional is suitably terminated.

Which of the following actions should you take?

  1. You should consider making use of the #undef directive.
  2. You should consider making use of the #endif directive.
  3. You should consider making use of the #else directive.
  4. You should consider making use of the #elif directive.

Answer: 2

QUESTION NO: 14

 You have been tasked with creating an application allows users to enter time and dates. You are writing code that includes a DateTime method, which converts the indicated string representation of a date and time to its DateTime equivalent and returns a value that specifies whether the conversion was successful.

Which of the following is the DateTime method that is being included?

  1. TryParse(String, DateTime)
  2. TryParse(String, IFormatProvider, DateTimeStyles, DateTime)
  3. TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateTime)
  4. TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateTime)

 Answer: 1

QUESTION NO: 15

You are currently writing code that uses a lambda expression to create an event handler.

Which of the following is TRUE with regards to lambda expressions? (Choose all that apply.)

  1. It is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
  2. It is a sequence of one or more operands and zero or more operators that can be evaluated to a single value, object, method, or namespace.
  3. It is a program element that is applied to one or more operands in an expression or statement.
  4. It is an expression of actions taken by the program.

 Answer: 1

QUESTION NO: 16

You are running a training exercise for junior developers. You are currently discussing the use of the Public access modifier to specify the declared accessibility of a member or a type.

Which of the following is TRUE with regards to the Public access modifier?

  1. It only allows access to the containing class or types derived from the containing class.
  2. It only allows access to the current assembly.
  3. It only allows access to the current assembly or types derived from the containing class.
  4. It only allows access to the containing type.
  5. It allows unrestricted.

 Answer: 5

QUESTION NO: 17

The written code includes an abstract class.

Which of the following is TRUE with regards to abstract classes? (Choose all that apply.)

  1. It cannot be instantiated.
  2. It cannot be used as a base class.
  3. It provides a common definition of a base class that multiple derived classes can share.
  4. It is used to prevent derivation.

Answer: 1,3

QUESTION NO: 18

 You are running a training exercise for junior developers. You are currently discussing the use of the HashTable collection type.

Which of the following is TRUE with regards to the HashTable collection type?

  1. It represents a first in, first out (FIFO) collection of objects.
  2. It represents a last in, first out (LIFO) collection of objects.
  3. It represents a collection of key/value pairs that are organized based on the hash code of the key.
  4. It represents a list of objects that can be accessed by index.

 Answer: 3

QUESTION NO: 19

 You have been tasked with creating an application allows users to enter time and dates. You are writing code that includes a DateTime method, which converts the indicated string representation of a date and time to its DateTime equivalent using the specified format, culture-specific format information, and style. The method requires the format of the string representation to match the specified format exactly. The method then returns a value that indicates whether the conversion was successful.

Which of the following is the DateTime method that is being included?

  1. TryParse(String, DateTime)
  2. TryParse(String, IFormatProvider, DateTimeStyles, DateTime)
  3. TryParseExact(String, String, IFormatProvider, DateTimeStyles, DateTime)
  4. TryParseExact(String, String[], IFormatProvider, DateTimeStyles, DateTime)

 Answer: 3

QUESTION NO: 20

 You are in the process of writing debug code that must include an attribute that makes the execution of a method dependent on a preprocessing identifier.

Which of the following is the action you should take?

  1. You should consider making use of the Obsolete attribute.
  2. You should consider making use of the Conditional attribute.
  3. You should consider making use of a custom attribute.
  4. You should consider making use of a global attribute.
  5. You should consider making use of a Visual Basic attribute.

 Answer: 2

QUESTION NO: 21

 You are running a training exercise for junior developers. You are currently discussing the use of a collection type that represents a doubly linked list.

Which of the following is the collection type being discussed?

  1. The List<T>collection type.
  2. The SortedList<T> collection type.
  3. The SortedSet<T> collection type.
  4. The LinkedList<T> collection type.

 Answer: 4