Deck 24: C++11 Additional Features

ملء الشاشة (f)
exit full mode
سؤال
Each time a new shared_ptr to the resource is created, the reference count ________, and each time one is destroyed, the reference count ________.

A) increases, increases
B) increases, decreases
C) decreases, increases
D) decreases, decreases
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A copy constructor, a destructor and an overloaded assignment operator are usually provided as a group for any class that uses dynamically allocated memory. With the addition of move semantics in C++11, you should also provide __________.
A) a move constructor

A) and b)
B) a move assignment operator
C) an overloaded move destructor
D) both
سؤال
A unique_ptr automatically calls ________ to free its associated dynamic memory when the unique_ptr is destroyed or goes out of scope.

A) release
B) destroy
C) erase
D) delete
سؤال
The ________ multithreading header contains class thread for manually creating and starting threads, and functions yield, get_id, sleep_for and sleep_until.

A)
B)
C)
D)
سؤال
Weak_ptrs should be used in any situation where you need to ________ the resource but don't want to assume any management responsibilities for it.

A) delete
B) copy
C) observe
D) move
سؤال
Which statement is false:

A) A weak_ptr points to the resource managed by a shared_ptr without assuming any responsibility for it.
B) The reference count for a shared_ptr doesn't increase when a weak_ptr references it. That means that the resource of a shared_ptr can be deleted while there are still weak_ptrs pointing to it. When the last shared_ptr is destroyed, the resource is deleted and any remaining weak_ptrs are set to NULL.
C) One use for weak_ptr s is to avoid memory leaks caused by circular references.
D) None of the above.
سؤال
The internal pointer is deleted once the last ________ to the resource is destroyed.

A) smart pointer
B) shared_ptr
C) weak_ptr
D) link
سؤال
The ________ multithreading header contains classes and class templates for ensuring mutually exlusive access to resources shared among threads in an application.

A)
B)
C)
D)
سؤال
When the reference count reaches zero, the ________ is deleted and the memory is released.

A) internal pointer
B) external pointer
C) internal reference
D) external reference
سؤال
In the following function int square(int value)
{
Return value * value;
}
The noexcept keyword indicates that this function ________.

A) does not catch exceptions
B) does not throw exceptions
C) does not test for exceptions
D) None of the above.
سؤال
Which of the following statements is false?

A) The thread launch policy is a value from the launch enum-either launch::async, launch::deferred or both separated by a bitwise OR (|) operator.
B) The thread launch policy value launch::async indicates that a specified function should execute in the current thread.
C) Function async returns an object of class template future that you can use when the thread completes execution to obtain data returned by the function that async executes. The thread launch policy value launch::deferred indicates that a specified function should execute in the same thread when the program uses the future object returned by function template async to get the result.
D) To ensure that a program does not terminate until its threads terminate and to receive the results from each thread, we call each future's get member function. This causes the program to wait until the corresponding threads complete execution-known as joining the threads-before executing the remaining code in main.
سؤال
There are many cases in which the object being copied is about to be destroyed, such as a temporary object that was returned from a function by value or a local object that's going out of scope. In such cases, it's better to move the contents of the object that's about to be destroyed into the destination object, thus avoiding ________.

A) a memory leak
B) a runtime error
C) a memory exhaustion error
D) any copying overhead
سؤال
The ________ multithreading header contains class templates, a function template and enums that enable you specify functions to execute in separate threads and to receive the results of those functions when the threads complete.

A)
B)
C)
D)
سؤال
Which statements is false:

A) shared_ptrs provide the pointer operators dot(.), star(*) and arrow(->).
B) We get the reference count using the shared_ptr member function use_count, which returns the number of shared_ptrs to the resource.
C) Changes made to the resource of a shared_ptr are "seen" by all shared_ptrs to that resource.
D) shared_ptr member function reset releases the current resource and sets the shared_ptr to NULL. If there are no other shared_ptrs to the resource, it's destroyed.
سؤال
The ________ multithreading header contains classes, a function and an enum that are used together with facilities in header to implement thread synchronization. In particular, condition variables can be used to make threads wait for a specific condition in a program, then to notify the waiting threads when that condition is satisfied.

A)
B)
C)
D)
سؤال
Which statement is false?

A) There's overhead inherent in multithreading.
B) Simply dividing a task into two threads and running it on a dual core system does not run it twice as fast, though it will typically run faster than performing the thread's tasks in sequence on one core.
C) Executing a multithreaded application on a single-core processor can actually take longer than simply performing the thread's tasks in sequence.
D) None of the above.
سؤال
Smart pointers ________.

A) strengthen the process of memory allocation and deallocation
B) help you write exception safe code
C) help prevent memory leaks
D) all of the above
سؤال
If a program throws an exception before delete has been called on a pointer, it creates a memory leak. After an exception is thrown, a(n) ________ destructor will still be called, which calls delete on the pointer for you.

A) reference's
B) inherited
C) smart pointer's
D) virtual
سؤال
Shared_ptrs use ________ counting to determine how many shared_ptrs point to the resource.

A) pointer
B) link
C) smart pointer
D) reference
سؤال
Though multithreading has been around for decades, interest in it is rising quickly due to the proliferation of ________ systems.
a. virtual
b. object-oriented
c. polymorphic
d. multicore
سؤال
A tuple's ________ copies a tuple's elements into a new tuple of the same type.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
سؤال
The ________ operator is particularly useful when working with complex template types for which it's often difficult to provide, or even determine, the proper type declaration. Rather than trying to write a complex type declaration, for example, that represents the return type of a function, you can place in the parentheses of this operator an expression that returns the complex type and let the compiler "figure it out."

A) infer_type
B) decltype
C) determine_type
D) static_assert
سؤال
A tuple's ________ moves a tuple's elements into a new tuple of the same type.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
سؤال
Operator ________ enables the compiler to determine an expression's type at compile time.
a. static_assert
b. assert
c. decltype
d. typedef
سؤال
In C++11, in a class called Employee that has explicitly defined constructors, you can specify that the default constructor should be generated with the declaration ________.

A) Employee() = decltype;
B) Employee() = explicit;
C) Employee() = default;
D) Employee() = generate:
سؤال
In general, move constructors and move assignment operators should not throw exceptions because they're simply moving resources, not allocating new ones. For this reason, both the move constructor and move assignment operator are declared ________ in their prototypes and definitions.
a. const
b. nothrow
c. noexcept
d. noerror
سؤال
An rvalue reference is declared as ________ (where T is the type of the object being referenced. to distinguish it from a normal reference ________ (called an lvalue reference).

A) &&T, &T
B) T&, T&&
C) T*, T->
D) T&&, T&
سؤال
Tuples that contain the same number of members ________.

A) cannot be compared to one another
B) can be compared to one another using only equality operators
C) can be compared to one another using only relational operators
D) can be compared to one another using the relational and equality operators
سؤال
An rvalue reference is used to implement move semantics-instead of being ________, the object's state (i.e., its content) is ________, leaving the original in a state that can be properly destructed.

A) copied, moved
B) moved, copied
C) assigned, initialized
D) initialized, assigned
سؤال
Prior to C++11 the following code created a temporary string object and passed it to push_back, which then copied it into the vector: vector myVector;
MyVector.push_back("message");
As of C++11, member function push_back is now overloaded with a version that takes a(n) ________. This allows the preceding call to push_back to take the storage allocated for the temporary string and reuse it directly for the new element in the vector. The temporary string will be destroyed when the function returns, so there's no need for it to keep its content.

A) const pointer
B) rvalue reference
C) rvalue pointer
D) const reference
سؤال
A common example of a variadic template is the C++11's new tuple class (from header ), which is a generalization of class template ________.

A) triple
B) quad
C) pair
D) singleton
سؤال
A tuple's ________ uses the assignment operator (=) to copy the elements of the tuple in the right operand into a tuple of the same type in the left operand. The element types stored in the constructor argument must be copy assignable.

A) move assignment
B) copy constructor
C) move constructor
D) copy assignment
سؤال
The ________ allows you to test constant integral expressions at compile time rather than runtime.
a. static_assert declaration
b. assert macro
c. static declaration
d. assert declaration
سؤال
A ________ template accepts any number of arguments, which can greatly simplify template programming.

A) variable
B) varargs
C) var_arguments
D) variadic
سؤال
If the initializer for a const variable is a function call, then the initialization occurs at ________.

A) compile time
B) load time
C) preprocessor time
D) run time
سؤال
Which of the following statements is true when a class contains both a copy constructor and a move constructor.

A) The compiler prefers to use the copy constructor.
B) The compiler prefers the move constructor.
C) The programmer explicitly specifies which to use in each case.
D) The compiler decides which one to use based on the context.
سؤال
Which of the following statements is true?

A) When working with many of the C++ Standard Library containers, you can use the new member functions emplace, emplace_front, emplace_back, emplace_after and emplace_hint to insert objects into containers.
B) The emplace member functions insert objects into contains without invoking any copy or move operations.
C) The emplace member functions actually contruct new objects in place in the new container elements.
D) All of the above.
سؤال
A tuple is a fixed-size collection of values that can be of ________.

A) any integral type
B) any character type
C) any string type
D) any type
سؤال
Which of the following statements creates a tuple containing two strings, an int and a double?
A) and (b).

A) tuple hammerInventory{"12345", "Hammer", 32, 9.95};
B) auto hammerInventory{make_tuple(string("12345"), string("Hammer"), 32, 9.95)};
C) tuple hammerInventory{"12345", "Hammer", 32, 9.95};
D) Both
سؤال
A tuple's ________ creates a tuple in which each member is value initialized-primitive type values are set to 0 or the equivalent of 0 and objects of class types are initialized with their default constructors.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
سؤال
A tuple's ________ uses the assignment operator (=) to move the elements of the tuple in the right operand into a tuple of the same type in the left operand. The element types stored in the constructor argument must be copy assignable.

A) copy assignment
B) move assignment
C) copy constructor
D) move constructor
سؤال
Which of the following statements about regular expressions is true.

A) The set of braces containing two numbers, {n,m}, matches between n and m occurrences (inclusively) of the pattern that it quantifies.
B) All of the regular expression quantifiers are greedy; they'll match as many occurrences of the pattern as possible until the pattern fails to make a match.
C) If a quantifier is followed by a question mark (?), the quantifier becomes lazy and will match as few occurrences as possible as long as there is a successful match.
D) All of the above.
سؤال
Which of the following statements about regular expressions is false.

A) Both "A*" and "A+" will match "A", but only "A*" will match an empty string.
B) "\d" matches any decimal digit.
C) The pattern "[aeiou]" matches any vowel.
D) The quantifier ? in a regular expression matches one or more occurrences of the preceding pattern.
سؤال
Which of the following initializes a vector with a list initializer:

A) vector integers{1, 2, 3, 4, 5, 6};
B) vector integers{1, 2, 3, 4, 5, 6};
C) vector integers(1, 2, 3, 4, 5, 6);
D) None of the above.
سؤال
Which of the following statements about regular expressions is false?

A) The quantifier {n,} in a regular expression matches at least n occurrences of the preceding pattern.
B) The quantifier {n,m} in a regular expression matches between n and m (inclusive) occurrences of the preceding pattern.
C) The question mark (?) quantifier matches one occurrence of the pattern that it quantifies.
D) A set of braces containing one number, {n}, matches exactly n occurrences of the pattern it quantifies.
سؤال
Assuming strings of the format: "Robert's birthday is 10-22-90"
What does the following regex match?
// create a regular expression
Regex expression("J.*\\d[0-35-9]-\\d\\d-\\d\\d");

A) Birthdays that occur in April and that belong to people whose names begin with "J".
B) Birthdays that belong to people whose names begin with "J".
C) Birthdays that do not occur in April and that belong to people whose names begin with "J".
D) None of the above.
سؤال
Which of the following statements is false?

A) Regular expressions are specially formatted strings that are used to find patterns in text.
B) Regular expressions can be used to validate data to ensure that it is in a particular format.
C) The regex library algorithm regex_search, returns true if any part of an arbitrary string matches the regular expression.
D) Character classes can be used with regular expressions. Character classes are C++ classes with escape sequences that represent groups of characters that might appear in a string.
سؤال
The raw string literal R"(multiple
Lines
Of
Text)"
Is treated as the string literal

A) "multiple\rlines\rof\rtext"
B) "multiple lines of text"
C) "multiple\nlines\nof\ntext"
D) raw string literals may not be treated as string literals
سؤال
Which of the following statements is true?

A) A class with multiple base classes can inherit constructors from any of its base classes.
B) If a class inherits constructors with the same signature from two or more base classes, then the derived class must define its own version of that constructor; otherwise, a compilation error occurs.
C) When a derived class is inheriting constructors from a base class and explicitly defines a constructor, if a default constructor is needed, the derived class must define a default constructor either by using = default to tell the compiler to generate the default constructor or by explicitly defining a constructor that can be called with no arguments.
D) All of the above.
سؤال
C++11 enables you to define functions and constructors that receive list initializers as arguments. To do so, you specify a parameter that uses the ________ class template.

A) list_initializer
B) initializer
C) list
D) initializer_list
سؤال
As of C++11, C++ now supports raw string literals that have the format R"optionalDelimiter(characters)optionalDelimiter"
Which of the following statements is false:

A) The optionalDelimiter before the left parenthesis, (, and after the right parenthesis,), must be identical, if provided.
B) The parentheses are required around the characters that compose the raw string literal.
C) The compiler automatically inserts backslashes as necessary in a raw string literal to properly escape special characters like double quotes ("), backslashes (\), etc.
D) None of the above.
سؤال
Which of the following statements about raw string literals is false.

A) Raw string literals are restricted to use with regular expressions.
B) Raw string literals may be used in any context that requires a string literal.
C) Raw string literals may include line breaks, in which case the compiler inserts \n escape sequences.
D) None of the above is false.
سؤال
Which of the following statements about regular expresions is false.
a. regex_match returns true only if the entire string matches the regular expression.
b. a-z matches any lowercase letter, and A-Z matches any uppercase letter.
c. The expression \d{5} matches any five digits.
d. The character "|" matches only the expression to its left.
سؤال
Which of the following statements about regular expressions is true?

A) The quantifier * in a regular expression matches one or more occurrences of the preceding pattern.
B) The quantifier + in a regular expression matches zero or more occurrences of the preceding pattern.
C) The quantifier {n} in a regular expression copies exactly n occurrences of the preceding pattern.
D) None of the above.
سؤال
A ________ iterates through the parts of a string that match a regular expression.

A) regex_iterator
B) string_iterator
C) regex_token_iterator
D) string_match_iterator
سؤال
In a regular expression, the dot character "." matches any single character. When the dot character is followed by a(n) ________, the regular expression matches any number of unspecified characters.

A) plus sign (+)
B) question mark (?)
C) dollar sign ($)
D) asterisk (*)
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/56
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 24: C++11 Additional Features
1
Each time a new shared_ptr to the resource is created, the reference count ________, and each time one is destroyed, the reference count ________.

A) increases, increases
B) increases, decreases
C) decreases, increases
D) decreases, decreases
B
2
A copy constructor, a destructor and an overloaded assignment operator are usually provided as a group for any class that uses dynamically allocated memory. With the addition of move semantics in C++11, you should also provide __________.
A) a move constructor

A) and b)
B) a move assignment operator
C) an overloaded move destructor
D) both
D
3
A unique_ptr automatically calls ________ to free its associated dynamic memory when the unique_ptr is destroyed or goes out of scope.

A) release
B) destroy
C) erase
D) delete
D
4
The ________ multithreading header contains class thread for manually creating and starting threads, and functions yield, get_id, sleep_for and sleep_until.

A)
B)
C)
D)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
5
Weak_ptrs should be used in any situation where you need to ________ the resource but don't want to assume any management responsibilities for it.

A) delete
B) copy
C) observe
D) move
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which statement is false:

A) A weak_ptr points to the resource managed by a shared_ptr without assuming any responsibility for it.
B) The reference count for a shared_ptr doesn't increase when a weak_ptr references it. That means that the resource of a shared_ptr can be deleted while there are still weak_ptrs pointing to it. When the last shared_ptr is destroyed, the resource is deleted and any remaining weak_ptrs are set to NULL.
C) One use for weak_ptr s is to avoid memory leaks caused by circular references.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
7
The internal pointer is deleted once the last ________ to the resource is destroyed.

A) smart pointer
B) shared_ptr
C) weak_ptr
D) link
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
8
The ________ multithreading header contains classes and class templates for ensuring mutually exlusive access to resources shared among threads in an application.

A)
B)
C)
D)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
9
When the reference count reaches zero, the ________ is deleted and the memory is released.

A) internal pointer
B) external pointer
C) internal reference
D) external reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
10
In the following function int square(int value)
{
Return value * value;
}
The noexcept keyword indicates that this function ________.

A) does not catch exceptions
B) does not throw exceptions
C) does not test for exceptions
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
11
Which of the following statements is false?

A) The thread launch policy is a value from the launch enum-either launch::async, launch::deferred or both separated by a bitwise OR (|) operator.
B) The thread launch policy value launch::async indicates that a specified function should execute in the current thread.
C) Function async returns an object of class template future that you can use when the thread completes execution to obtain data returned by the function that async executes. The thread launch policy value launch::deferred indicates that a specified function should execute in the same thread when the program uses the future object returned by function template async to get the result.
D) To ensure that a program does not terminate until its threads terminate and to receive the results from each thread, we call each future's get member function. This causes the program to wait until the corresponding threads complete execution-known as joining the threads-before executing the remaining code in main.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
12
There are many cases in which the object being copied is about to be destroyed, such as a temporary object that was returned from a function by value or a local object that's going out of scope. In such cases, it's better to move the contents of the object that's about to be destroyed into the destination object, thus avoiding ________.

A) a memory leak
B) a runtime error
C) a memory exhaustion error
D) any copying overhead
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
13
The ________ multithreading header contains class templates, a function template and enums that enable you specify functions to execute in separate threads and to receive the results of those functions when the threads complete.

A)
B)
C)
D)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
14
Which statements is false:

A) shared_ptrs provide the pointer operators dot(.), star(*) and arrow(->).
B) We get the reference count using the shared_ptr member function use_count, which returns the number of shared_ptrs to the resource.
C) Changes made to the resource of a shared_ptr are "seen" by all shared_ptrs to that resource.
D) shared_ptr member function reset releases the current resource and sets the shared_ptr to NULL. If there are no other shared_ptrs to the resource, it's destroyed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
15
The ________ multithreading header contains classes, a function and an enum that are used together with facilities in header to implement thread synchronization. In particular, condition variables can be used to make threads wait for a specific condition in a program, then to notify the waiting threads when that condition is satisfied.

A)
B)
C)
D)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which statement is false?

A) There's overhead inherent in multithreading.
B) Simply dividing a task into two threads and running it on a dual core system does not run it twice as fast, though it will typically run faster than performing the thread's tasks in sequence on one core.
C) Executing a multithreaded application on a single-core processor can actually take longer than simply performing the thread's tasks in sequence.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
17
Smart pointers ________.

A) strengthen the process of memory allocation and deallocation
B) help you write exception safe code
C) help prevent memory leaks
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
18
If a program throws an exception before delete has been called on a pointer, it creates a memory leak. After an exception is thrown, a(n) ________ destructor will still be called, which calls delete on the pointer for you.

A) reference's
B) inherited
C) smart pointer's
D) virtual
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
19
Shared_ptrs use ________ counting to determine how many shared_ptrs point to the resource.

A) pointer
B) link
C) smart pointer
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
20
Though multithreading has been around for decades, interest in it is rising quickly due to the proliferation of ________ systems.
a. virtual
b. object-oriented
c. polymorphic
d. multicore
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
21
A tuple's ________ copies a tuple's elements into a new tuple of the same type.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
22
The ________ operator is particularly useful when working with complex template types for which it's often difficult to provide, or even determine, the proper type declaration. Rather than trying to write a complex type declaration, for example, that represents the return type of a function, you can place in the parentheses of this operator an expression that returns the complex type and let the compiler "figure it out."

A) infer_type
B) decltype
C) determine_type
D) static_assert
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
23
A tuple's ________ moves a tuple's elements into a new tuple of the same type.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
24
Operator ________ enables the compiler to determine an expression's type at compile time.
a. static_assert
b. assert
c. decltype
d. typedef
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
25
In C++11, in a class called Employee that has explicitly defined constructors, you can specify that the default constructor should be generated with the declaration ________.

A) Employee() = decltype;
B) Employee() = explicit;
C) Employee() = default;
D) Employee() = generate:
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
26
In general, move constructors and move assignment operators should not throw exceptions because they're simply moving resources, not allocating new ones. For this reason, both the move constructor and move assignment operator are declared ________ in their prototypes and definitions.
a. const
b. nothrow
c. noexcept
d. noerror
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
27
An rvalue reference is declared as ________ (where T is the type of the object being referenced. to distinguish it from a normal reference ________ (called an lvalue reference).

A) &&T, &T
B) T&, T&&
C) T*, T->
D) T&&, T&
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
28
Tuples that contain the same number of members ________.

A) cannot be compared to one another
B) can be compared to one another using only equality operators
C) can be compared to one another using only relational operators
D) can be compared to one another using the relational and equality operators
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
29
An rvalue reference is used to implement move semantics-instead of being ________, the object's state (i.e., its content) is ________, leaving the original in a state that can be properly destructed.

A) copied, moved
B) moved, copied
C) assigned, initialized
D) initialized, assigned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
30
Prior to C++11 the following code created a temporary string object and passed it to push_back, which then copied it into the vector: vector myVector;
MyVector.push_back("message");
As of C++11, member function push_back is now overloaded with a version that takes a(n) ________. This allows the preceding call to push_back to take the storage allocated for the temporary string and reuse it directly for the new element in the vector. The temporary string will be destroyed when the function returns, so there's no need for it to keep its content.

A) const pointer
B) rvalue reference
C) rvalue pointer
D) const reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
31
A common example of a variadic template is the C++11's new tuple class (from header ), which is a generalization of class template ________.

A) triple
B) quad
C) pair
D) singleton
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
32
A tuple's ________ uses the assignment operator (=) to copy the elements of the tuple in the right operand into a tuple of the same type in the left operand. The element types stored in the constructor argument must be copy assignable.

A) move assignment
B) copy constructor
C) move constructor
D) copy assignment
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
33
The ________ allows you to test constant integral expressions at compile time rather than runtime.
a. static_assert declaration
b. assert macro
c. static declaration
d. assert declaration
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
34
A ________ template accepts any number of arguments, which can greatly simplify template programming.

A) variable
B) varargs
C) var_arguments
D) variadic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
35
If the initializer for a const variable is a function call, then the initialization occurs at ________.

A) compile time
B) load time
C) preprocessor time
D) run time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following statements is true when a class contains both a copy constructor and a move constructor.

A) The compiler prefers to use the copy constructor.
B) The compiler prefers the move constructor.
C) The programmer explicitly specifies which to use in each case.
D) The compiler decides which one to use based on the context.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which of the following statements is true?

A) When working with many of the C++ Standard Library containers, you can use the new member functions emplace, emplace_front, emplace_back, emplace_after and emplace_hint to insert objects into containers.
B) The emplace member functions insert objects into contains without invoking any copy or move operations.
C) The emplace member functions actually contruct new objects in place in the new container elements.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
38
A tuple is a fixed-size collection of values that can be of ________.

A) any integral type
B) any character type
C) any string type
D) any type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following statements creates a tuple containing two strings, an int and a double?
A) and (b).

A) tuple hammerInventory{"12345", "Hammer", 32, 9.95};
B) auto hammerInventory{make_tuple(string("12345"), string("Hammer"), 32, 9.95)};
C) tuple hammerInventory{"12345", "Hammer", 32, 9.95};
D) Both
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
40
A tuple's ________ creates a tuple in which each member is value initialized-primitive type values are set to 0 or the equivalent of 0 and objects of class types are initialized with their default constructors.

A) copy constructor
B) move assignment
C) move constructor
D) default constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
41
A tuple's ________ uses the assignment operator (=) to move the elements of the tuple in the right operand into a tuple of the same type in the left operand. The element types stored in the constructor argument must be copy assignable.

A) copy assignment
B) move assignment
C) copy constructor
D) move constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following statements about regular expressions is true.

A) The set of braces containing two numbers, {n,m}, matches between n and m occurrences (inclusively) of the pattern that it quantifies.
B) All of the regular expression quantifiers are greedy; they'll match as many occurrences of the pattern as possible until the pattern fails to make a match.
C) If a quantifier is followed by a question mark (?), the quantifier becomes lazy and will match as few occurrences as possible as long as there is a successful match.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following statements about regular expressions is false.

A) Both "A*" and "A+" will match "A", but only "A*" will match an empty string.
B) "\d" matches any decimal digit.
C) The pattern "[aeiou]" matches any vowel.
D) The quantifier ? in a regular expression matches one or more occurrences of the preceding pattern.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following initializes a vector with a list initializer:

A) vector integers{1, 2, 3, 4, 5, 6};
B) vector integers{1, 2, 3, 4, 5, 6};
C) vector integers(1, 2, 3, 4, 5, 6);
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
45
Which of the following statements about regular expressions is false?

A) The quantifier {n,} in a regular expression matches at least n occurrences of the preceding pattern.
B) The quantifier {n,m} in a regular expression matches between n and m (inclusive) occurrences of the preceding pattern.
C) The question mark (?) quantifier matches one occurrence of the pattern that it quantifies.
D) A set of braces containing one number, {n}, matches exactly n occurrences of the pattern it quantifies.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
46
Assuming strings of the format: "Robert's birthday is 10-22-90"
What does the following regex match?
// create a regular expression
Regex expression("J.*\\d[0-35-9]-\\d\\d-\\d\\d");

A) Birthdays that occur in April and that belong to people whose names begin with "J".
B) Birthdays that belong to people whose names begin with "J".
C) Birthdays that do not occur in April and that belong to people whose names begin with "J".
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following statements is false?

A) Regular expressions are specially formatted strings that are used to find patterns in text.
B) Regular expressions can be used to validate data to ensure that it is in a particular format.
C) The regex library algorithm regex_search, returns true if any part of an arbitrary string matches the regular expression.
D) Character classes can be used with regular expressions. Character classes are C++ classes with escape sequences that represent groups of characters that might appear in a string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
48
The raw string literal R"(multiple
Lines
Of
Text)"
Is treated as the string literal

A) "multiple\rlines\rof\rtext"
B) "multiple lines of text"
C) "multiple\nlines\nof\ntext"
D) raw string literals may not be treated as string literals
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
49
Which of the following statements is true?

A) A class with multiple base classes can inherit constructors from any of its base classes.
B) If a class inherits constructors with the same signature from two or more base classes, then the derived class must define its own version of that constructor; otherwise, a compilation error occurs.
C) When a derived class is inheriting constructors from a base class and explicitly defines a constructor, if a default constructor is needed, the derived class must define a default constructor either by using = default to tell the compiler to generate the default constructor or by explicitly defining a constructor that can be called with no arguments.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
50
C++11 enables you to define functions and constructors that receive list initializers as arguments. To do so, you specify a parameter that uses the ________ class template.

A) list_initializer
B) initializer
C) list
D) initializer_list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
51
As of C++11, C++ now supports raw string literals that have the format R"optionalDelimiter(characters)optionalDelimiter"
Which of the following statements is false:

A) The optionalDelimiter before the left parenthesis, (, and after the right parenthesis,), must be identical, if provided.
B) The parentheses are required around the characters that compose the raw string literal.
C) The compiler automatically inserts backslashes as necessary in a raw string literal to properly escape special characters like double quotes ("), backslashes (\), etc.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
52
Which of the following statements about raw string literals is false.

A) Raw string literals are restricted to use with regular expressions.
B) Raw string literals may be used in any context that requires a string literal.
C) Raw string literals may include line breaks, in which case the compiler inserts \n escape sequences.
D) None of the above is false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
53
Which of the following statements about regular expresions is false.
a. regex_match returns true only if the entire string matches the regular expression.
b. a-z matches any lowercase letter, and A-Z matches any uppercase letter.
c. The expression \d{5} matches any five digits.
d. The character "|" matches only the expression to its left.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
54
Which of the following statements about regular expressions is true?

A) The quantifier * in a regular expression matches one or more occurrences of the preceding pattern.
B) The quantifier + in a regular expression matches zero or more occurrences of the preceding pattern.
C) The quantifier {n} in a regular expression copies exactly n occurrences of the preceding pattern.
D) None of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
55
A ________ iterates through the parts of a string that match a regular expression.

A) regex_iterator
B) string_iterator
C) regex_token_iterator
D) string_match_iterator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
56
In a regular expression, the dot character "." matches any single character. When the dot character is followed by a(n) ________, the regular expression matches any number of unspecified characters.

A) plus sign (+)
B) question mark (?)
C) dollar sign ($)
D) asterisk (*)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 56 في هذه المجموعة.