Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C++ » C++ Objective Questions (Page-13)

C++ Objective Questions - Page-13

Page 13 (241 - 260)

Question: 241

(A) True
(B) False

Compiler
Level: Practitioner Category: exceptions
[Posted by: Admin | Chicago, USA]


Question: 242

(A) Function declaration has error
(B) Behaviour is unknown
(C) Function will throw only standard exceptions defined in <exception>
(D) Function will not throw any exception

Compiler
Level: Practitioner Category: exceptions
[Posted by: Admin | Chicago, USA]


Question: 243

(A) True
(B) False

Compiler
Level: Beginner Category: loops
[Posted by: Admin | Chicago, USA]


Question: 244

(A) 100
(B) 0
(C) Compilation Error
(D) Garbage Value is printed

Compiler
Level: Expert Category: inheritance
[Posted by: Admin | Chicago, USA]


Question: 245

(A) Equal
(B) EqualEqual
(C) EqualNotEqual
(D) NotEqual

Compiler
Level: Practitioner Category: conditional
[Posted by: Admin | Chicago, USA]


Question: 246

(A) Yes
(B) No

Compiler
Level: Beginner Category: namespace
[Posted by: Admin | Chicago, USA]


Question: 247

(A) Before all #include
(B) After #include<iostream>
(C) In middle of #includes
(D) After all #inludes

Compiler
Level: Beginner Category: namespace
[Posted by: Admin | Chicago, USA]


Question: 248

(A) Using the entire namespace, using only single name from namespace
(B) There is no difference
(C) We can't use only cout from std namespace

Compiler
Level: Beginner Category: namespace
[Posted by: Admin | Chicago, USA]


Question: 249

(A) Runtime Error
(B) Compilation Erro
(C) Nothing is printed
(D) CppBuzz.com

Compiler
Level: Beginner Category: namespace
[Posted by: Admin | Chicago, USA]


Question: 250

(A) Program is terminated without printing anything on console
(B) Prints 'constructor' and then it is terminated
(C) constructor.destructor. but ptr is never freed
(D) constructor.destructor. And ptr is freed

Compiler
Level: Practitioner Category: pointers
[Posted by: Admin | Chicago, USA]


Question: 251

(A) C++11's weak_ptrs are used with shared_ptrs.
(B) C++11's weak_ptrs can be used without weak_ptrs
(C) C++11's weak_ptrs are replacement of unique_ptr
(D) C++11's weak_ptrs are used for unique ownership

Compiler
Level: Practitioner Category: pointers
[Posted by: Admin | Chicago, USA]


Question: 252

(A) We can only use these smart pointers to refer to objects allocated with new
(B) It is recommended that you do not use both 2 shared_ptr and raw pointer on the same object
(C) It can't be copied or assigned to another shared_ptr
(D) We can also reset a shared_ptr by assigning it the value nullptr

Compiler
Level: Practitioner Category: pointers
[Posted by: Admin | Chicago, USA]


Question: 253

(A) This is valid code snippet with no error
(B) Error: Copy construction is not allowed at line 2
(C) Error: Assignment is not allowed at line 2
(D) Error: Runtime exception

Compiler
Level: Practitioner Category: pointers
[Posted by: Admin | Chicago, USA]


Question: 254

(A) We can't transfer the ownership of unique pointers
(B) It is possible using copy constructor - unique_ptr<Thing> ptr2(ptr1);
(C) ptr2 = std::move(ptr1);
(D) ptr2 = ptr1

Compiler
Level: Expert Category: pointers
[Posted by: Admin | Chicago, USA]


Question: 255

(A) Address of memory allocated | Garbage Value
(B) Address of memory allocated | 0
(C) Address of ptr | 0
(D) Address of ptr | Garbage Value

Compiler
Level: Beginner Category: new_delete
[Posted by: Admin | Chicago, USA]


Question: 256

(A) Program runs without any error
(B) Compilation Error
(C) Runtime error (Segmentation fault)
(D) None of the above

Compiler
Level: Beginner Category: new_delete
[Posted by: Admin | Chicago, USA]


Question: 257

(A) bad_exception
(B) overflow_error
(C) out_of_range
(D) bad_alloc

Compiler
Level: Practitioner Category: new_delete
[Posted by: Admin | Chicago, USA]


Question: 258

(A) 08
(B) 04
(C) 84
(D) 48

Compiler
Level: Practitioner Category: inheritance
[Posted by: Admin | Chicago, USA]


Question: 259

(A) base
(B) Nothing is printed
(C) basebase
(D) None of the Above

Compiler
Level: Practitioner Category: inheritance
[Posted by: Admin | Chicago, USA]


Question: 260

(A) Hello Derived
(B) Hello Base
(C) Hello Derived Hello Base
(D) Hello Base Hello Derived

Compiler
Level: Practitioner Category: typecasting
[Posted by: Admin | Chicago, USA]