3i Infotech Papers: Sample Questions 459 - 461 of 1245

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

Question number: 459

» Basic CS » Data Structures

Essay Question▾

Describe in Detail

Define pointer to function that take argument as character pointer and return void pointer.

Explanation

  • (void*) (*foo) (*char).

Declare a pointer to function:

  • int * ptrInteger;

    • here, ptrInteger is a pointer to integer.

  • int foo (int);

    • foo is a function that returns int and take one argument of int type.

    • A * operator between int and foo (int) should create a pointer to a function.

    • We have to bind operator * with foo.

  • int (*foo) (int);

    • * operator is with foo which is a function name.

  • Like normal data pointer, a function pointer can be passed as an argument and also returned from a function.

Ex. .

void fun1 ()

{

print (“Fun1 ”);

}

void fun2 ()

{

printf (” fFun2 ”)

}

void wrapped (void (*fun) () )

{

fun ();

}

int main ()

{

wrapper (fun1);

wrapper (fun2);

return 0;

}

  • We can use function pointer to avoid code redundancy.

  • Function pointers and void pointers, it is possible to use qsort for any data type.

Question number: 460

» Basic CS » Data Structures

Short Answer Question▾

Write in Short

Name 1 limitation of using an array to hold data.

Explanation

  • It can only hold data of the same type.

  • It is not easy to resize dynamically with memory allocated in blocks.

Question number: 461

» Database » Oracle

MCQ▾

Question

A Transaction ends

Choices

Choice (4) Response

a.

When it is Committed or Rolledback

b.

Only when it is Committed

c.

Only when it is Rolledback

d.

Question does not provide sufficient data or is vague

Answer

a.

Explanation

  • A Transaction ends when it is committed or rolledback

A Transaction

  • A logical unit of work- contains one or more SQL statement

  • An atomic unit.

  • Begins with the first executable SQL statement.

  • Explicit transaction starts with the BEGIN TRANSACTION statement and end with the COMMIT or ROLLBACK statement.

  • Lasts until it completes without errors- COMMIT transaction is issued to make modifications of the database, all modifications are erased with a ROLLBACK transaction statement.

  • The COMMIT means the changes made in the current transaction are made permanent.

  • A ROLLBACK statement cancels all modifications made by the current transaction.

  • Both COMMIT and ROLLBACK release all InnoDB locks set during the current transaction.