Quiz QUIZ 1

Xingye Liao

Member
C++ Student
Hi, in the quiz, I meet some problems that I have tried several times but failed. I want to know the correct answers. Thanks~
@APalley @GONG CHEN

Which of the following statements regarding the noexceptspecifier are true?
○If used, it guarantees that client functions will not throw exceptions.
○The stack is unwound when using the C++11 exception specification.
○The C++98 exception specification is still supported in C++11 but it is deprecated.
○It is part of a function's specification.

I tried A and C, but all failed.

What is the noexcept specifier?
○It specifies whether a function will throw exceptions.
○It is a way to suppress exceptions being thrown to clients.
○It ensures that all exceptions will be thrown from a function.
○It performs a compile-time check that returns true if an expression is declared to not throw any exception.

A variadic functionis one that has:
○Takes a variable number of arguments of specific types.
○C++11 does not support variadic functions; they are supported in C++14.
○Arguments whose type are variant.
○Takes a variable number of template arguments.

I wonder if the answer is A.

Which properties does std::bitset have? (Choose 2)
○Bitsets do not throw exceptions.
○The number of bits in a bitset cannot be changed.
○Its size can be configured at run-time.
○Bitsets can be initialized by string literals.

I feel really confused about this question. I think A and B are both wrong, but choosing C and D is not right.

Which of the following statements concerning the decltypespecifier is true?
○It can be used instead of an auto variable.
○It can be used to determine the return type of template functions.
○It cannot be used with lambda functions.
○It can be used when standard notation fails.

If I remember correctly, 2 answers should be chosen.
 

GONG CHEN

Well-Known Member
C++ Student
Which of the following statements regarding the noexceptspecifier are true?
-- It is part of a function's specification
-- no except(false) will allow the function to throw.

What is the noexcept specifier?
-- It specifies whether a function will throw exceptions.

A variadic functionis one that has:
-- Takes a variable number of template arguments (See 1.3)

Which properties does std::bitset have? (Choose 2)
-- Bitsets can be initialized by string literals.
-- The number of bits in a bitset cannot be changed.
-- You will see these in 2.8

Which of the following statements concerning the decltypespecifier is true?
-- It can be used to determine the return type of template functions.
-- It can be used instead of an auto variable.
-- e.g. prior to C++14, you can write (now, you don't need ->decltype(t))
template<typename T> auto f(T t) -> decltype(t) {return t; }
-- auto x = 5; or decltype(5) x = 5;
 

Xingye Liao

Member
C++ Student
Which of the following statements regarding the noexceptspecifier are true?
-- It is part of a function's specification
-- no except(false) will allow the function to throw.

What is the noexcept specifier?
-- It specifies whether a function will throw exceptions.

A variadic functionis one that has:
-- Takes a variable number of template arguments (See 1.3)

Which properties does std::bitset have? (Choose 2)
-- Bitsets can be initialized by string literals.
-- The number of bits in a bitset cannot be changed.
-- You will see these in 2.8

Which of the following statements concerning the decltypespecifier is true?
-- It can be used to determine the return type of template functions.
-- It can be used instead of an auto variable.
-- e.g. prior to C++14, you can write (now, you don't need ->decltype(t))
template<typename T> auto f(T t) -> decltype(t) {return t; }
-- auto x = 5; or decltype(5) x = 5;
Thanks~ Your answers are really helpful!
 
Top