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 101

HPCL Engineer 2017• Professional Knowledge

Which of the following statements about the following binary tree is FALSE?

  1. AOption (a)

    Nodes ‘J’ and ‘K’ are siblings.

  2. BOption (b)

    Node ‘B’ is the ancestor of node ‘J’

  3. COption (c)

    It is a binary search tree.

  4. DOption (d)

    It is a complete binary tree. 

View answer & explanation

Correct answer

Answer: (c)C.

It is a binary search tree.

Why this answer is correct

Concept:

Binary search tree: A BST is a tree in which all the nodes follow the two properties.

  1. The left sub tree of a node has a key less than or equal to its parent node’s key.

  2. The right sub tree of a node has a key greater than its parent’s key.

Complete binary tree: A complete binary tree is a binary tree in which every level except possibly the last level is completely filled and all nodes are as left as possible.

Explanation:

In this tree, it is clearly showing that node J and K are siblings.

Also, given tree is satisfying the property of a complete binary tree.

But it is not following the property of binary search tree. So, option 3) it is a binary search tree is incorrect here.

Question 102

HPCL Engineer 2017• Professional Knowledge

Suppose that we have an ordered file with r = 30000 records stored on a disk with block size B = 1024 bytes. If file records are of fixed size and are unspanned with record length R = 100 bytes, the blocking factor for the file and the number of blocks needed for the file are _____ and _____ respectively.

  1. AOption (a)

    110, 3000

  2. BOption (b)

    10, 300

  3. COption (c)

    10, 3000

  4. DOption (d)

    110, 30000

View answer & explanation

Correct answer

Answer: (c)C.

10, 3000

Why this answer is correct

Concept:

Blocking factor: Number of records that can be stored in one block. It is calculated by dividing the block size by the length of each record.

Calculation:

Block size = 1024 bytes

Number of records = 30000

Record length or size = 100 bytes

File records are of fixed size and unspanned.

So, blocking factor = 1024/ 100 = ⌊10.24⌋ = 10

To find number of blocks needed:

10 records require = 1 block

1 record requires = 1/ 10 block

30000 records require = \(\frac{1}{{10}}; \times ;30000 = 3000\) blocks

Question 103

HPCL Engineer 2017• Professional Knowledge

A flip-flop has a 20-nano second delay from the time its CP input goes from 1 to 0 to the time the output is complimented. What is the maximum delay in a 16-bit binary ripple counter that user these flip-flops?

  1. AOption (a)

    16 ns

  2. BOption (b)

    320 ns

  3. COption (c)

    36 ns

  4. DOption (d)

    20 ns

View answer & explanation

Correct answer

Answer: (b)B.

320 ns

Why this answer is correct

Concept: A ripple counter is an asynchronous counter where only the first flip – flop is clocked by an external clock. All subsequent flip –f lops are clocked by the output of the preceding flip – flop.

Calculation:

Given that delay of one flip- flop = 20 ns

Here, we have to find the maximum delay before the output of the counter has settled to the next value. This will happen when all the bits will change.

As, it is a ripple counter, next bit cannot change until the previous is set.

So, the worst case will be when we multiply the number of flip flops with delay of one flip flop.

So, maximum delay in a 16- bit ripple counter = 20 × 16 = 320 ns

Question 104

HPCL Engineer 2017• Professional Knowledge

Match the following.

List IList II
I) AttenuationP) Loss of energy
II) ShannonQ) Changes in shape of the signal
III) Nyquist bit rateR) Noisy channel
IV) DistortionS) Noiseless channel
  1. AOption (a)

    I – Q, II – P, III – S, IV - R

  2. BOption (b)

    I – P, II – Q, III – R, IV - S

  3. COption (c)

    I – S, II – R, III – Q, IV - P

  4. DOption (d)

    I – P, II – R, III – S, IV - Q

View answer & explanation

Correct answer

Answer: (d)D.

I – P, II – R, III – S, IV - Q

Why this answer is correct

Attenuation: Attenuation is the loss of communication signal strength. It means loss of energy. When a signal travels through a medium, it loses some of its energy in overcoming the resistance of the medium.

Distortion: It means that the signal changes its form or shape. Distortion can occur in a composite signal made up of different frequencies. Signal components at the receiver have phases different from what they has at the sender. The shape of the signal is not the same.

Nquist Bit rate: Nquist bit rate is used for noiseless channels. It defines the bit rate as:

Bit rate = 2 × bandwidth × log2L, where L is the number of signal levels.

Shannon capacity: Shannon capacity is used for noisy channels. Bit rate in this case:

Bit rate = bandwidth × log2(1 + SNR), where SNR is signal to noise ratio.

Question 105

HPCL Engineer 2017• Professional Knowledge

Match the following.

List - 1List - 2
I) Independent accessA) RAID 0
II) Parallel accessB) RAID 3
III) MirroringC) RAID 5
IV) StripingD) RAID 1
  1. AOption (a)

    I – C, II – B, III – D, IV - A

  2. BOption (b)

    I – B, II – A, III – D, IV - C

  3. COption (c)

    I – A, II – D, III – B, IV - C

  4. DOption (d)

    I – B, II – C, III – D, IV - A

View answer & explanation

Correct answer

Answer: (a)A.

I – C, II – B, III – D, IV - A

Why this answer is correct

RAID (Redundant array of inexpensive disks or drives) is a technology that is used to increase the performance and reliability of data storage. It consists of two or more drives working in parallel. There are different RAID levels, each optimized for a specific situation.

RAID 0 – Striping

RAID 1 – mirroring

RAID 5 - distributed parity

RAID 3 – parallel access

RAID 6 – Double distributed parity

RAID 10 – combining mirroring and striping

The software to perform the RAID- functionality and control the drives can either be located on a separate controller or it can simply be a driver.

Question 106

HPCL Engineer 2017• Professional Knowledge

The output of the following ‘C’ language code is:

void main()

{

            char arr[10];

            arr = “world”;

            printf(“%s”,arr);

}

  1. AOption (a)

    L-value required error

  2. BOption (b)

    world

  3. COption (c)

    world10

  4. DOption (d)

    world5

View answer & explanation

Correct answer

Answer: (a)A.

L-value required error

Why this answer is correct

Here, arr is the starting address of the array.

arr = “world” will give the error     // L- value required error.

Because, it doesn’t allow you to do the assignment since arr is an array not a free pointer.

This statement is to assign the pointer value of world to arr but cannot change the arr since nothing is pointing to the array. This can work if arr is a char* .

Question 107

HPCL Engineer 2017• Professional Knowledge

Which of the following data structures allows both addition and deletion of items from either end?

  1. AOption (a)

    Double Ended Queue

  2. BOption (b)

    priority Queue

  3. COption (c)

    Stack 

  4. DOption (d)

    Queue 

View answer & explanation

Correct answer

Answer: (a)A.

Double Ended Queue

Why this answer is correct

Double ended queue:

it is queue data structure in which deletion and insertion can be possible from either end. We can insert at both front and rear end and can delete from both the ends.

Priority queue:

A priority queue is a special type of queue in which each element is associated with a priority and is served according to its priority.

Stack:

Stack is a data structure which follows a particular order in which the operations are performed. The order stack follows is LIFO (Last in first out).

Queue:

Queue is a data structure which follows the order FIFO (First in First out).

Question 108

HPCL Engineer 2017• Professional Knowledge

Considering the relation schemas R (A, B, C, D) and S (C, D, E, F), what will be the degree of the resultant relation of the following Relational Algebra expression, Where “*” represents the “natural join” operation?

\(\left( {{\sigma _{c1}}\left( {{\pi _{A,B,C}}\left( R \right)} \right)} \right)*\left( {{\sigma _{c2}}\left( {{\pi _{C,D,E}}\left( S \right)} \right)} \right)\)

  1. AOption (a)

    5

  2. BOption (b)

    3

  3. COption (c)

    6

  4. DOption (d)

    4

View answer & explanation

Correct answer

Answer: (a)A.

5

Why this answer is correct

Concept:

A natural join compares two relational schemas and is structured in such a way that columns with the same name of associated tables will appear only once.

Rules for natural join:

  1. The tables have one or more pairs of identically named columns.

  2. The columns must be same data type

Explanation:

The degree of a relation is the number of attributes in the table or the number of columns.

Here given two relational schemas R (A, B, C, D) and S (C, D, E, F).

Given expression is:

In this first we take the attribute A, B, C and apply the condition and then select the tuples, but number of attributes will remain same as A, B, C.

Similarly, for relational schema S according to the relational expression we will consider only attribute C, D, E.

So, when we do the natural join of these two results, we will find total 5 attributes in the final table.

So, degree of resultant relation = 5

Question 109

HPCL Engineer 2017• Professional Knowledge

Consider the list of numbers 1, 2, 3 …….. 1000 is stored in a [0 ... 999]. what will be the total number of comparisons to search x = 501 using the following binary search () function?

int binary search(int a [], int n, int x} {int low = 0, high = n-1;

while (low <= high) {int m = (low + high)/2;

if(x > a[m]) low = m + 1;

else if(x < a[m]) high = m – 1;

else return m;

}

return –1;

}

Note:- [only include if-else comparison to conclude the answer]

  1. AOption (a)

    17

  2. BOption (b)

    1

  3. COption (c)

    2

  4. DOption (d)

    15

View answer & explanation

Correct answer

Answer: (a)A.

17

Why this answer is correct

Initially low = 0, high = n-1

n = 1000, So, high = 999

x = 501

1)while (0 <= 999) ---------------true

m = (0 + 999)/2 = 499

if(501 > a[m]), i.e. if (501 > a[499] )i.e. if (501 > 500) ----------true      [1st comparison]

low = 499 + 1 = 500

  1. while(500 < = 999) -----------------true

m = (500 + 999)/2 = 749

if(501 > 749 ) --------------false   [2nd comparison]

elseif(501 < 749) ---------true         [3rd comparison]

high = 749 – 1 = 748

  1. while (500 <= 748) ----------------true

m = (500 + 748)/ 2 = 624

if (501 > 624) ------------false     [4th comparison]

elseif(501 < 624) -------------true    [5th comparison]

high = 624 -1 = 623

  1. while (500 < = 623) ---------------true

m = (500 + 623)/2 = 581

if(501 > 581) -------------false     [6th comparison]

elseif( 501 < 581)--------------true   [7th comparison]

high = 581 - 1 = 580

  1. while (500 < = 580) ---------true

m = (500 + 580)/ 2 = 540

if ( 501 > 540)---------false       [8th comparison]

else if (501 < 540) --------------true   [9th comparsion]

high = 539

  1. while (500<= 539) -----------true

m = (500 + 539)/2 = 519

if (501 > 519) ---------------false    [10th comparison]

elseif (501 < 519) ----------------true   [11th comparison]

high = 519 - 1 = 518

  1. while (500 < = 518) --------------true

m = (500 + 518)/ 2 = 509

if( 501 > 509 ) ---------------false    [12th comparison]

elseif( 501 < 509) --------------true    [13th comparison]

high = 509 – 1 = 508

  1. while(500 <= 508) -----------true

m = (500 + 508)/2 = 504

if(501 > 504)------------false     [14th comparison]

elseif(501 < 504 ) ----------true    [15th comparison]

high = 503

  1. while (500 <= 503) ---------------true

m = (500 + 503)/2 = 501

if(501 > 501) ----------false                [16th comparison]

elseif( 501 < 501 )----------false              [17th comparison]

else part will be executed and it will return m i.e. location where the required element is present.

So, total 17 comparisons are required in this case.

Question 110

HPCL Engineer 2017• Professional Knowledge

If T is a binary tree with number of levels as L, then the number of leaf nodes in the binary tree is at most:

  1. AOption (a)

    2L

  2. BOption (b)

    2L-1

  3. COption (c)

    2L + 1

  4. DOption (d)

    2L

View answer & explanation

Correct answer

Answer: (b)B.

2L-1

Why this answer is correct

Concept:

Level is the number of nodes on path from root to the node.

Explanation:

If T is a binary tree with number of levels as L, then number of leaf nodes in the binary tree is at most 2L-1.

Consider, tree has only one level, then number of nodes = 21-1 = 20 = 1

It means tree will have only one node i.e. root

If tree has two levels, then maximum nodes possible at that level = 22-1 = 2

i.e. maximum 2 leafs are possible and 3 total nodes are possible with 2 levels.

Similarly, if we take 3 levels, number of nodes that level = 23-1 = 4

i.e. maximum leaf nodes possible = 4 and total nodes = 7

So, if we take level as L, total leaf nodes possible are atmost 2L-1.