Ok, more low-level language quizzes. Here you go (multiple answers allowed). Answers before Saturday.QuoteQuiz Set 1 C++11/C++14// nullptr1. What is a nullptr? Give one answera) It is a null pointer constantb) It is the same as the C NULL macroc) It is a global C++ pointerd) It is an integer whose value is 02. How would you characterise nullptr? True or false?a) It resolves ambiguities inherent in C and C++b) It resolves the overloading pointer and integer syndrome in function callsc) std::nullptr_t converts to all pointer typesd) nullptr cannot be used with templates// static_assert3. What is static_assert?a) Is check that static variables have been initializedb) It is a compile-time check on the validity of a boolean conditionc) It is a run-time checkerd) Is it the same as the C assert macro4. Which of the following statements concerning static_assert is true?a) It leads to compile-time errorsb) It may appear at block scopec) It may not appear at class scoped) It only works with constant expressions and string literals// auto5. What is the auto specifier? a) It is similar to typedef to make code more readableb) It is used to declare variables and functions instead of fixed typesc) It is used to declare heterogeneous data types d) It is used to specialise template parameters6. Which of the following statements concerning the auto specifier is true?a) The type of variable being declared is automatically deduced from its initializerb) For functions, the return type is deduced from the return statementsc) The keyword auto may be accompanied by modifiers such as const and &d) Mixing auto variables and functions in one declarations is allowed// decltype7. What is decltype?a) It replaces typedef from C++11 onwardsb) It is used to let the compiler find the type of an expression or of an entityc) It is used to find the type of an expression at run-timed) It is used to convert values in an expression8. Which of the following statements concerning the decltype specifier is true?a) It can be used instead of an auto variableb) It can be used to determine the return type of template functionsc) It can be used when standard notation failsd) It cannot be used with lambda functions9. What is declval?a) It declares a reference typeb) It converts any type T to a reference typec) It generates values as input arguments to functionsd) It returns the return type of a function call expression at compile time// noexcept10. What is the noexcept specifier?a) It performs a compile-time check that returns true if an expression is declared to not throw any exceptionb) It specifies whether a function will throw exceptionsc) It is a way to suppress exceptions being thrown to clientsd) It ensures that all exceptions will be thrown from a function11. Which of the following statements regarding the noexcept specifier are true?a) If used, it guarantees that client functions will not throw exceptionsb) The C++98 exception specification is still supported in C++11 but it is deprecatedc) The stack is unwound when using the C++11 exception specificationd) It is part of a function?s specification12. What is the noexcept operator?a) It performs a compile-time check that returns true if an expression is declared to not throw any exceptionb) It serves the same objectives as the noexcept specifierc) It is not supported in C++11d) It specifies whether a function will throw exceptions// constexpr13. What is the constexpr specifier?a) It defines an expression that can be evaluated at compile timeb) It specifies that the value of a variable can appear in constant expressionsc) It specifies that the value of a variable or function can appear in constant expressionsd) It has the same functionality as const14. Which of the following statements regarding the constexpr specifier are true?a) All constexpr objects are const but not all const objects are constexpr b) A constexpr variable must be immediately constructed and assigned a valuec) constexpr functions may be virtuald) constexpr values are known at compile-time while const values can be defined at run-time// alias template 15. What is the alias template (type alias) declaration in C++11?a) It is a way to create an alias that can be used anywhere instead of a (possibly complex) non-template type nameb) It is a derived class of a template classc) It is a name that refers to a previously defined type (it refers to a family of types)d) It is used to improve code performance16. Which of the following statements regarding the alias template (type alias) declaration are true?a) It can be partially and explicitly specialisedb) It does not introduce a new typec) An alias template is defined using the keyword aliasd) It helps in making template code more readable (for example, C++ smart pointers)17. Which of the following statements regarding the alias template (type alias) declaration are true?a) An alias template cannot be defined in terms of another alias templateb) An alias can be used instead of the C++98 typedef declaration for both template and non-template synonymsc) The using keyword simplifies the readability of function pointer declarationsd) Aliased template and non-template classes can be members of classes (Composition)// New fundamental data types18. Which of the following new data types are supported in C++11?a) char32_tb) unsigned long longc) long intd) std::nullptr_t19. What is correct regarding main() in the C++ standard?a) It is require to provide a return statementb) Any return value other than 0 represents failurec) It may have void as its return typed) Only two declarations of main() are portable20. Which of the following regarding auto() are true?a) auto variables must be initialisedb) It is subject to pitfalls (for example, it can deduce undesired types)c) It is not immune to type mismatchesd) Mixing auto variables and functions in one declaration is allowed.//
Last edited by Cuchulainn
on September 9th, 2015, 10:00 pm, edited 1 time in total.