Search Previous Year Questions

Find real questions from previous competitive exam papers with answers and solutions.

Leave the keyword blank to browse saved questions for your selected exam, newest papers first. Add a keyword, year or topic to narrow the results.

Browse complete papers
Showing 10 question(s)
Clear

Question 121

HPCL Engineer 2017• Professional Knowledge

Logical data independence is the ability to change ______ schema without having to change _____schema.

  1. AOption (a)

    Conceptual; internal 

  2. BOption (b)

    Conceptual; external 

  3. COption (c)

    Internal; external

  4. DOption (d)

    internal; conceptual

View answer & explanation

Correct answer

Answer: (b)B.

Conceptual; external 

Why this answer is correct

Concept:

Data independence is defined as a property of DBMS that helps you to change the database schema at one level of a database system without requiring to higher level.

Explanation:

Database has 3 levels:

  1. Physical level

  2. Conceptual level

  3. External level

Two types of data independence

a) logical data independence b) physical data independence

Logical data independence:

Logical data is data about database. It is a kind of mechanism which liberalizes itself from actual data stored on the disk. It is the ability to change the conceptual scheme without changing external view or APIs.

Any change made will be absorbed by the mapping between external and conceptual levels.

Physical data independence:

It is mainly concerned with the storage of the data. A change in the physical level usually does not need change at application program level.

Question 122

HPCL Engineer 2017• Professional Knowledge

In clustering index, the number of index entries is same as the number of:

  1. AOption (a)

    attributes in data file 

  2. BOption (b)

    blocks in data file

  3. COption (c)

    distinct index field values

  4. DOption (d)

    records in data file 

View answer & explanation

Correct answer

Answer: (c)C.

distinct index field values

Why this answer is correct

A clustered index is an ordered file with two fields, the first field is the same as the clustering field is called monkey, and the second is the block pointer.

It is created on a data file whose file records are physically ordered on a non-key field which does not have a distinct value for each record that field is called the clustering field.

Some important points:

  1. Index entry is created for each distinct value of a clustering field

  2. block pointer points to the first block in which key is available.

  3. type of index is sparse index

Question 123

HPCL Engineer 2017• Professional Knowledge

The 9’s compliment of the decimal number 139452 is:

  1. AOption (a)

    860547

  2. BOption (b)

    860548

  3. COption (c)

    971658

  4. DOption (d)

    971659

View answer & explanation

Correct answer

Answer: (a)A.

860547

Why this answer is correct

9’s complement can be find out by subtracting the given number from 9.

Subtract each and every digit of a given number by digit 9.

i.e. 999999 – 139452 = 860547

Question 124

HPCL Engineer 2017• Professional Knowledge

Which of the following statements is INCORRECT with respect to pointers declared in the following ‘C’ language code?

void main()

{

            int a[10], *p, *q;

            p=&a[5];

            q=&a[7];

}

  1. AOption (a)

    q-3

  2. BOption (b)

    p+1

  3. COption (c)

    q-p

  4. DOption (d)

    p+q

View answer & explanation

Correct answer

Answer: (d)D.

p+q

Why this answer is correct

A pointer in C language is an address which is a numeric value. We can perform arithmetic operations on a pointer just as on a numeric value. But there are some restrictions in case of pointers:

Valid pointer operations are:

  1. assignment of pointers of same type

  2. adding or subtracting a pointer or an int

  3. subtracting or comparing two pointers to members of same array

  4. assigning or comparing to zero

We cannot add two pointers. Because if we add two pointers, then in case of array it can go out of the scope.

Question 125

HPCL Engineer 2017• Professional Knowledge

If P is a two-dimensional array having 10 rows and 20 columns, then which of the following cannot be used to access the element in row 2 and column 5?

  1. AOption (a)

    P[2][5]

  2. BOption (b)

    ((P+2)+5)

  3. COption (c)

    *(P + 2 + 5)

  4. DOption (d)

    *(P [2] + 5)

View answer & explanation

Correct answer

Answer: (c)C.

*(P + 2 + 5)

Why this answer is correct

Consider all the options one by one:

  1. P[2][5]

It represents the element present in 2nd row and 5th column.

  1. ((P+2) + 5)

*(P+2) ---- it leads to enter 2nd row

*(P+2)+5 ------- will give address of element present at 5th column of 2nd row.

((P+2) + 5) ------- it will represent at 5th column of 2nd row.

  1. *(P + 2 + 5)

*(P+7) ------- will return starting address of 7th row.

  1. *(P [2] + 5)

It will also return the element present at 5th column of 2nd row.

Question 126

HPCL Engineer 2017• Professional Knowledge

Two schedules are said to be ________, if the order of any two conflicting operations is same in both the schedules. 

  1. AOption (a)

    Conflict equivalent

  2. BOption (b)

    View equivalent

  3. COption (c)

    schema equivalent 

  4. DOption (d)

    result equivalent 

View answer & explanation

Correct answer

Answer: (a)A.

Conflict equivalent

Why this answer is correct

Conflict equivalent: Two schedules are said to be conflict equivalent when one can be transformed to another by swapping non – conflicting operations. Two schedules are conflict equivalent if the order of any two conflicting operations is same in both the schedules.

Example:

T1T2
Read(A)
Write(A)
Read(B)
Write(B)
Read(A)
Write(A)
Read(B)
Write(B)

 

View equivalent: Two schedules are said to be view equivalent if they satisfy these conditions:

1)  Initial read: Initial read of each data item must match in both schedules.

  1. Final write: it means if a data item X is last written by transaction T1 in schedule S1 then in S2, the last write operation on X should be performed by the transaction T1.

  2. Update read: If in schedule S1, the transaction T1 is reading a data item updated by T2 then in schedule S2, T1 should read the value after the write operation of T2 on same data item.

Question 127

HPCL Engineer 2017• Professional Knowledge

Which of the following is the time complexity of dynamic programming algorithm to compute the Binomial coefficient nCk?

  1. AOption (a)

    Θ(n + k)

  2. BOption (b)

    Θ(nk)

  3. COption (c)

    Θ(Kn)

  4. DOption (d)

    Θ(nk)

View answer & explanation

Correct answer

Answer: (d)D.

Θ(nk)

Why this answer is correct

A binomial coefficient nCk gives us the number of ways that k objects can be chose among n objects. WE have to find k element subset from n element set.

To calculate the value of binomial coefficient we call it recursively as :

nCk = n-1Ck-1 + n-1Ck for n> k> 0

nC0 = nCn = 1            (Base case)

It is computed by constructing a table.

Cost of the algorithm is the cost of filling the table.  Because k< = n, this sum is to be splitted into two parts.

T(n,k) = sum for upper triangle + sum for lower triangle

\(= \mathop \sum \limits_{i = 1}^k \mathop \sum \limits_{j = 1}^k 1 + \mathop \sum \limits_{i = 1}^n \mathop \sum \limits_{j = 1}^k 1\)

\(= \mathop \sum \limits_{i = 1}^k \left( {i - 1} \right) + \mathop \sum \limits_{i = 1}^n k\)

= (k-1)k/2 + k (n-k) = nk

So, time complexity to compute the binomial coefficient is : Θ(nk)

Question 128

HPCL Engineer 2017• Professional Knowledge

Which of the following problem cannot be solved using greedy approach?

  1. AOption (a)

    Huffman code

  2. BOption (b)

    Minimum spanning tree

  3. COption (c)

    Job scheduling

  4. DOption (d)

    0 -1 knapsack

View answer & explanation

Correct answer

Answer: (d)D.

0 -1 knapsack

Why this answer is correct

Concept:

A greedy approach tries to find a localized optimum solution, which may eventually lead to globally optimized solutions. It also makes the choice that seems to be the best at that moment.

Some of the problems which use a greedy approach:

  • Traveling salesman problem
  • Prim’s algorithm (Minimum spanning tree)
  • Huffman code
  • Graph – map colouring
  • Fractional knapsack problem
  • Job scheduling problem

Explanation:

For 0-1 knapsack, dynamic programming approach is used. It cannot be solved using greedy approach.

In 0-1 knapsack, items cannot be broken which means you should take the item as whole or should leave it.

Question 129

HPCL Engineer 2017• Professional Knowledge

Consider the following relation schema R and S along with their tuple sets.

R(A, B) = {<a1, b1 >, <a2, b1>, <a3, b1>, <a4, b1>, <a1, b2>, <a3, b2>, <a2, b3>, <a3, b3>, <a4, b3>, <a1, b4>, <a2, b4>, <a3, b4>}

S(A) = {a1, a2, a3}

What is the value of T ← R/S, where “/” represents the Relational Algebra “division” operation?

  1. AOption (a)

    T(B) = {b1, b2, b4}

  2. BOption (b)

    T(B) = {b1, b3, b4}

  3. COption (c)

    T(B) = {b1, b4)

  4. DOption (d)

    T(B) = {b1, b3}

View answer & explanation

Correct answer

Answer: (c)C.

T(B) = {b1, b4)

Why this answer is correct

The relation returned by the division operator between two relations A and B are those tuples from relation A which are associated to every B’s tuple.

R:

AB
a1b1
a2b1
a3b1
a4b1
a1b2
a3b2
a2b3
a3b3
a4b3
a1b4
a2b4
a3b4

 

S:

A
a1
a2
a3

Now check which values of A in S is associated with B in R.

a1 is associated with [b1, b2, b4]

a2 is associated with [b1, b3, b4]

a3 is associated with [b1, b2, b3, b4]

Now, [b1, b4] are the common elements that are associated with values of A in S.

T = R/S

T:

B
b1
b4

Question 130

HPCL Engineer 2017• Professional Knowledge

Which of the following statements is FALSE?

  1. AOption (a)

    A counter may count up or count down but cannot both up and down

  2. BOption (b)

    Asynchronous counters are slower than synchronous counters

  3. COption (c)

    Johnson counter is a synchronous counter

  4. DOption (d)

    Ripple counter is an asynchronous counter

View answer & explanation

Correct answer

Answer: (a)A.

A counter may count up or count down but cannot both up and down

Why this answer is correct

A counter is a device which tells about the number of times an event has occurred. Two types of counters are: Asynchronous counter and synchronous counter

Asynchronous counter: in this different flip- flops have different clock cycles. It is also known as ripple counter. Also known as parallel counter. Asynchronous counter operates in a fixed count sequence. Example of asynchronous counter: ripple counter etc.

Synchronous counter: All flip flops are triggered with same clock simultaneously. These types of counters are faster than asynchronous.  These are also known as serial counter. Examples of synchronous counter: ring counter, Johnson counter etc.