3i Infotech Papers: Sample Questions 778 - 779 of 1245

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 778

» Database » MySQL

Appeared in Year: 2006

Essay Question▾

Describe in Detail

What is the difference among “dropping a table” “truncating a table” and “deleting all records” from a table?


Drop Table

  • It will remove the existence of the table from the database along with its data and structure and all the constraints.

  • The table will be no longer available.

  • This is a DDL Statement.

Truncate Table

  • It will remove all the rows from a table.

  • It will not delete the table. It is a DDL statement that means the deleted rows cannot be reverted back by ROLLBACK statement.

  • It will only be used if users needs to delete the entire rows from a tables.

  • No conditions will be applied in Truncate.

Delete Table

  • It is a DML statement which will delete rows from a table according to the matching criteria mentions in the ‘where’ clause and these rows can be reverted back by ‘ROLLBACK’ statement if ‘COMMIT’ is not fired.

  • Delete statement will used in both the cases, eitehr selected rows or entire rows from tables.

Question number: 779

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is a small pointer?


  • A smart pointer works like a normal pointer but offers more functionality.

  • In C++, smart pointers are implemented as template classes encapsulating a pointer, overriding standard pointer operators.

  • They are guaranteed to be initialized as either null pointers or pointers to a heap object.

  • They check for indirection through a null pointer.

  • Deleting them is not necessary. Smart objects are freed when last pointer to them is deallocated.

  • Smart pointers however, do not respect inheritance. Hence they cannot be used for polymorphic code.

For example,

template class smart_pointer {public: smart_pointer (); // makes a null pointer smart_pointer (const X& x) // makes pointer to copy of x X& operator * (); const X& operator* () const; X * operator- > () const; smart_pointer (const smart_pointer &); const smart_pointer & operator = (const smart_pointer&); ~smart_pointer (); private://…};

  • This class implements a smart pointer to an object of type X. The object itself is located on the heap. Here is how to use it: smart_pointer p = employee (“Harris”, 1333); Like other overloaded operators, p will behave like a regular pointer, cout < < *p; p- > raise_salary (0.5);