+ All Categories
Home > Documents > 67976648 Complete Oracle Paper

67976648 Complete Oracle Paper

Date post: 06-Apr-2018
Category:
Upload: sanjay95
View: 219 times
Download: 0 times
Share this document with a friend

of 59

Transcript
  • 8/3/2019 67976648 Complete Oracle Paper

    1/59

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    2/59

    http://worldatyou.blogspot.com/

    Coding Skills (Advanced)

    Question Number 1

    Given the following code snippet:

    void InsertNode(tNode** node, int i){if(*node == NULL){

    *node = new tNode;(*node)->pLeft = NULL;(*node)->data = i;(*node)->pRight = NULL;SetRootNode(node);return;

    }else{

    if(i < (*node)->data)InsertNode(&((*node)->pLeft), i);

    if(i > (*node)->data)InsertNode(&((*node)->pRight), i);

    return;}

    }

    void Func(tNode **node){if(*node!=NULL){

    Func(&(*node)->pLeft);tNode *temp;temp = (*node)->pLeft;(*node)->pLeft= (*node)->pRight;(*node)->pRight = temp;Func(&(*node)->pRight);

    }}void traverse(tNode** nd){

    if(*nd!=NULL){traverse(&((*nd)->pLeft));traverse(&((*nd)->pRight));std::cout

  • 8/3/2019 67976648 Complete Oracle Paper

    3/59

    http://worldatyou.blogspot.com/

    std::coutGetRootNode(), data);

    }bT->InsertNode(bT->GetRootNode(), 99);bT->traverse(bT->GetRootNode());

    }

    110,5,12,96,78,15,99,110,120,100,98

    5,10,12,15,78,96,98,99,100,110,120

    120,110,100,99,98,96,78,15,12,10,5

    98,100,120,110,99,15,78,96,12,5,110

    Question Number 2

    Given the following code snippet:

    void InsertNode(tNode** node, int i){if(*node == NULL){

    *node = new tNode;(*node)->pLeft = NULL;

    (*node)->data = i;(*node)->pRight = NULL;SetRootNode(node);return;

    }else{

    if(i < (*node)->data)InsertNode(&((*node)->pLeft), i);

    if(i > (*node)->data)InsertNode(&((*node)->pRight), i);

    return;}

    }

    void Func(tNode **node){if(*node!=NULL){

    Func(&(*node)->pLeft);tNode *temp;temp = (*node)->pLeft;(*node)->pLeft= (*node)->pRight;(*node)->pRight = temp;Func(&(*node)->pRight);

    }

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    4/59

    http://worldatyou.blogspot.com/

    }void traverse(tNode** nd){

    if(*nd!=NULL){traverse(&((*nd)->pLeft));traverse(&((*nd)->pRight));std::coutInsertNode(bT->GetRootNode(), 99);bT->Func(bT->GetRootNode());

    bT->traverse(bT->GetRootNode());}

    5,10,12,15,78,96,98,99,100,1

    10,1205,12,10,99,96,78,15,110,120,100,98

    5,10,12,15,78,96,99,98,100,110,120

    98,100,120,110,15,78,96,99,10,12,5

    Question Number 3

    Given the following code snippet:

    void InsertNode(tNode**node, int i){

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    5/59

    http://worldatyou.blogspot.com/

    if(*node == NULL){*node = new tNode;(*node)->pLeft =

    NULL;(*node)->data = i;(*node)->pRight =

    NULL;SetRootNode(node);return;

    }else{

    if(i < (*node)->data)

    InsertNode(&((*node)->pLeft), i);

    if(i > (*node)->data)

    InsertNode(&((*node)->pRight), i);

    return;

    }}

    void Func(tNode **node){if(*node!=NULL){

    Func(&(*node)->pLeft);

    tNode *temp;temp = (*node)-

    >pLeft;(*node)->pLeft=

    (*node)->pRight;(*node)->pRight =

    temp; Func(&(*node)->pRight);

    }}void traverse(tNode** nd){

    if(*nd!=NULL){traverse(&((*nd)-

    >pLeft));traverse(&((*nd)-

    >pRight));std::cout

  • 8/3/2019 67976648 Complete Oracle Paper

    6/59

    http://worldatyou.blogspot.com/

    int main(void){

    tree *bT = new tree;int i = 10;int data;while(i--){

    std::coutGetRootNode(), data);}bT->Func(bT-

    >GetRootNode());bT->InsertNode(bT-

    >GetRootNode(), 99);bT->traverse(bT-

    >GetRootNode());}

    100,110,120,98,5,10,12,15,78,96,99

    99,96,78,15,12,10,5,98,120,110,100

    110,120,100,5,12,10,99,96,78,15,98

    98,15,78,96,99,10,12,5,100,120,110

    Question Number 4

    Given the following code snippet:

    void InsertNode(tNode** node, int i){if(*node == NULL){

    *node = new tNode;(*node)->pLeft = NULL;(*node)->data = i;

    (*node)->pRight = NULL;SetRootNode(node);return;

    }else{

    if(i < (*node)->data)InsertNode(&((*node)->pLeft), i);

    if(i > (*node)->data)InsertNode(&((*node)->pRight), i);

    return;

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    7/59

    http://worldatyou.blogspot.com/

    }}

    void Func(tNode **node){if(*node!=NULL){

    Func(&(*node)->pLeft);tNode *temp;temp = (*node)->pLeft;(*node)->pLeft= (*node)->pRight;(*node)->pRight = temp;Func(&(*node)->pRight);

    }}void traverse(tNode** nd){

    if(*nd!=NULL){traverse(&((*nd)->pLeft));traverse(&((*nd)->pRight));std::coutFunc(bT->GetRootNode());bT->InsertNode(bT->GetRootNode(), 99);bT->traverse(bT->GetRootNode());

    }

    98,15,78,96,97,99,10,12,5,100,120,110

    110,120,100,5,12,10,99,97,96,78,15,98

    100,110,120,98,5,10,12,15,78,96,97,99

    None of these

    Question Number 5

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    8/59

    http://worldatyou.blogspot.com/

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information.

    By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than

    one rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \/ \/ \+ +

    / / \/ / \/ / \

    "A" + "D"/ \/ \/ \

    "B" "C"

    Suppose we want the classes to implement getLeft and getRight to allow external code to

    navigate the tree. What should their return type be?

    Object

    Node

    InternalNode

    TerminalNode

    Question Number 6

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    9/59

    http://worldatyou.blogspot.com/

    A tree rooted at a node having left child A and right child B is a different tree thanone rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \/ \/ \+ +

    / / \/ / \/ / \

    "A" + "D"/ \/ \/ \

    "B" "C"

    Should InternalNode have simple setters, as follows?

    void setLeft(Node nd) {left = nd;

    }

    void setRight(Node nd) {right = nd;

    }

    Yes

    Optionalthe specifications dont imply either yes or no

    Nothe specifications directly forbid it

    Nothe specifications dont say one way or another but these implementations areinadequate

    Question Number 7

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    10/59

    http://worldatyou.blogspot.com/

    A tree rooted at a node having left child A and right child B is a different tree thanone rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \/ \/ \+ +

    / / \/ / \/ / \

    "A" + "D"/ \/ \/ \

    "B" "C"

    Consider this implementation oftoString():

    abstract class Node {String toString();

    }

    class TerminalNode extends Node {String toString() {

    return value;}

    }

    class InternalNode extends Node {String toString() {

    if (null == left)return "[" + right + "]";

    else if (null == right)return "[" + left + "]";

    elsereturn "[" + left + " " + right + "]";

    }}

    Under what conditions will this implementation distinguish (i.e. produce different stringsfor) two trees that have the same strings in the same sequence in their terminal nodes but

    different internal structures?

    Never

    Only for full trees (ones in which every internal node has two children, exceptpossibly the parent of the rightmost terminal node)

    Always

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    11/59

    http://worldatyou.blogspot.com/

    Question Number 8

    Given the following code snippet answer the following question.

    struct AVLTree{AVLTree * left;AVLTree * right;int element;int height;

    };int MAX(int a, int b){if(a>=b)

    return a;if(aheight;

    }}AVLTree * single_rotation_with_left(AVLTree *k2){AVLTree *k1;k1 = k2->left;k2->left = k1->right;k1->right = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;k1->height = MAX(height(k1->left), height(k2->right)) + 1;return k1;

    }

    AVLTree * single_rotation_with_right(AVLTree *k2){AVLTree *k1;k1 = k2->right;k2->right = k1->left;k1->left = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;k1->height = MAX(height(k1->right), height(k2->left)) + 1;

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    12/59

    http://worldatyou.blogspot.com/

    return k1;}AVLTree *double_rotation_with_left(AVLTree *k3){k3->left = single_rotation_with_right(k3->left);return single_rotation_with_left(k3);

    }AVLTree *double_rotation_with_right(AVLTree *k3){k3->right = single_rotation_with_left(k3->right);return single_rotation_with_right(k3);

    }void insert(int value, AVLTree **node){if (*node == NULL){*node = new AVLTree;if (*node == NULL){

    return;

    }(*node)->element = value;(*node)->height = 0;(*node)->left = (*node)->right = NULL;return;

    }else if (value < (*node)->element){insert(value, &((*node)->left));if (height((*node)->left) - height((*node)->right) == 2){if (value < (*node)->left->element){

    *node = single_rotation_with_left(*node);}else{*node = double_rotation_with_left(*node);

    }}

    }else if (value > (*node)->element){insert(value, &((*node)->right));if (height((*node)->right) - height((*node)->left) == 2){if (value > (*node)->right->element)

    {*node = single_rotation_with_right(*node);

    }else{*node = double_rotation_with_right(*node);

    }}}

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    13/59

    http://worldatyou.blogspot.com/

    (*node)->height = MAX(height((*node)->left), height((*node)->right)) +1;}

    Consider an input sequence that is provided as an input to the insert method

    20,5,15,9,13,2,6,12,14,15,16,17,18,19

    How many times method single_rotation_with_left is called while inserting 18

    1

    0

    2

    None of these

    Question Number 9

    Given the following code snippet answer the following question.

    struct AVLTree{AVLTree * left;AVLTree * right;

    int element;int height;

    };int MAX(int a, int b){

    if(a>=b)return a;

    if(aheight;

    }}AVLTree * single_rotation_with_left(AVLTree *k2){AVLTree *k1;

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    14/59

    http://worldatyou.blogspot.com/

    k1 = k2->left;k2->left = k1->right;k1->right = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;k1->height = MAX(height(k1->left), height(k2->right)) + 1;return k1;

    }

    AVLTree * single_rotation_with_right(AVLTree *k2){AVLTree *k1;k1 = k2->right;k2->right = k1->left;k1->left = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;k1->height = MAX(height(k1->right), height(k2->left)) + 1;return k1;

    }AVLTree *double_rotation_with_left(AVLTree *k3){

    k3->left = single_rotation_with_right(k3->left);return single_rotation_with_left(k3);

    }AVLTree *double_rotation_with_right(AVLTree *k3){k3->right = single_rotation_with_left(k3->right);return single_rotation_with_right(k3);

    }void insert(int value, AVLTree **node){if (*node == NULL){*node = new AVLTree;

    if (*node == NULL){return;

    }(*node)->element = value;(*node)->height = 0;(*node)->left = (*node)->right = NULL;return;

    }else if (value < (*node)->element){insert(value, &((*node)->left));if (height((*node)->left) - height((*node)->right) == 2){

    if (value < (*node)->left->element){*node = single_rotation_with_left(*node);

    }else{*node = double_rotation_with_left(*node);

    }}

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    15/59

    http://worldatyou.blogspot.com/

    }else if (value > (*node)->element){insert(value, &((*node)->right));if (height((*node)->right) - height((*node)->left) == 2){if (value > (*node)->right->element){*node = single_rotation_with_right(*node);

    }else{*node = double_rotation_with_right(*node);

    }}}

    (*node)->height = MAX(height((*node)->left), height((*node)->right)) +1;}

    Consider an input sequence that is provided as an input to the insert method20,5,15,9,13,2,6,12,14,15,16,17,18,19

    Which one of the following would be the root node after inserting 16.

    16

    17

    15

    9

    Question Number 10

    Given the following code snippet answer the following question.

    struct AVLTree{AVLTree * left;AVLTree * right;int element;int height;

    };int MAX(int a, int b){

    if(a>=b)return a;

    if(a

  • 8/3/2019 67976648 Complete Oracle Paper

    16/59

    http://worldatyou.blogspot.com/

    return b;}int height(AVLTree *node){if (node == NULL){return -1;

    }else{return node->height;

    }}AVLTree * single_rotation_with_left(AVLTree *k2){AVLTree *k1;k1 = k2->left;k2->left = k1->right;k1->right = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;

    k1->height = MAX(height(k1->left), height(k2->right)) + 1;return k1;

    }

    AVLTree * single_rotation_with_right(AVLTree *k2){AVLTree *k1;k1 = k2->right;k2->right = k1->left;k1->left = k2;k2->height = MAX(height(k2->left), height(k2->right)) + 1;k1->height = MAX(height(k1->right), height(k2->left)) + 1;return k1;

    }AVLTree *double_rotation_with_left(AVLTree *k3){k3->left = single_rotation_with_right(k3->left);return single_rotation_with_left(k3);

    }AVLTree *double_rotation_with_right(AVLTree *k3){k3->right = single_rotation_with_left(k3->right);return single_rotation_with_right(k3);

    }void insert(int value, AVLTree **node){if (*node == NULL)

    {*node = new AVLTree;if (*node == NULL){

    return;}(*node)->element = value;(*node)->height = 0;(*node)->left = (*node)->right = NULL;

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    17/59

    http://worldatyou.blogspot.com/

    return;}else if (value < (*node)->element){insert(value, &((*node)->left));if (height((*node)->left) - height((*node)->right) == 2){if (value < (*node)->left->element){*node = single_rotation_with_left(*node);

    }else{*node = double_rotation_with_left(*node);

    }}

    }else if (value > (*node)->element){insert(value, &((*node)->right));

    if (height((*node)->right) - height((*node)->left) == 2){if (value > (*node)->right->element){*node = single_rotation_with_right(*node);

    }else{*node = double_rotation_with_right(*node);

    }}}

    (*node)->height = MAX(height((*node)->left), height((*node)->right)) +1;}

    Consider an input sequence that is provided as an input to the insert method20,5,15,9,13,2,6,12,14,15,16,17,18,19In the process of inserting the above nodes how many times double_rotation_with_left isbeing called?

    5

    0

    3

    2

    Coding Skills (Advanced)

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    18/59

    http://worldatyou.blogspot.com/

    Question Number 1

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \/ \

    "B" "C"

    Which expression would create a representation of the following tree?

    IN0/ \/ \

    / \IN1 IN2/ / \/ / \/ / \

    "A" "D" IN3/ \

    / \/ \

    "B" "C"InternalNode tree =

    new InternalNode(new InternalNode(new TerminalNode("A"),

    null),new InternalNode(new TerminalNode("D"),

    new InternalNode(new TerminalNode("B"),new TerminalNode("C"))));

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    19/59

    http://worldatyou.blogspot.com/

    InternalNode tree =new InternalNode(

    new InternalNode(new TerminalNode("D"),new InternalNode(

    new TerminalNode("B"),new TerminalNode("C"))),

    new TerminalNode("A"))

    InternalNode tree =new InternalNode(

    new InternalNode(new TerminalNode("A")),new InternalNode(new TerminalNode("D"),

    new InternalNode(new TerminalNode("B"),new TerminalNode("C"))));

    InternalNode tree =new InternalNode(

    new InternalNode(new TerminalNode("A", null),null),

    new InternalNode(new TerminalNode("D", null),new InternalNode(

    new TerminalNode("B", null),new TerminalNode("C", null))));

    Question Number 2

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +

    / \/ \/ \+ +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    20/59

    http://worldatyou.blogspot.com/

    / \"B" "C"

    Having created a pathTo(String) method wed like to have the reverseoperation, atPath(List). Here is a proposed implementation. (Note that itreturns a Node, not a String.)

    abstract class Node {abstract bool isTerminal();abstract Node atPath(List lst);

    }

    class TerminalNode extends Node {boolean isTerminal { return True; }Node atPath(List lst) {

    if (lst.isEmpty())return this;

    return null;}

    }

    class InternalNode extends Node {boolean isTerminal { return False; }Node atPath(List lst) {

    Node curnode = this;InternalNode ind = null;for (int n = 0; n < lst.size(); n++) {

    if (curnode.isTerminal())return null;

    String dir = lst.get(n);if (!dir.equals("L") && !dir.equals("R"))

    return null;ind = (InternalNode) curnode;

    if (dir.equals("L"))curnode = ind.getLeft();

    elsecurnode = ind.getRight();

    }return curnode;

    }}

    Which of the possible conditions does the code handle correctly?

    A. An empty subtree is encountered before the end of the path.

    B. The path leads to a TerminalNode.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    21/59

    http://worldatyou.blogspot.com/

    C. The path leads to an InternalNode.

    All of them.

    A but neither B nor C.

    A and B but not C

    B and C but not A.

    Question Number 3

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \/ \

    "B" "C"

    We want to locate the first occurrence of a string in the tree and return apath that shows how to navigate to it from the root. The path will berepresented as a list of strings, with L indicating that the left childshould be followed and R that the right child should be followed. The listL, R would identify the right child of the left child of the root of thetree.

    Assume there is a List data structure available that provides

    a constructor for creating an empty List

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    22/59

    http://worldatyou.blogspot.com/

    addLast(String) to add a string to the end of the list returning the(modified) list so that, for example, a series of additions could bechainedfor example:

    lst.addLast("a").addLast("b")

    Similarly, addFirst(String) adds to the front of the list and returnsthe modified list.

    Given an abstract definition in Node:

    abstract pathTo(String str);and the definition in TerminalNode:

    List pathTo(String str) {if (value.equals(str))

    return new List();else

    return null;}

    Which of the following definitions will work correctly to produce the path asdescribed above (or null if the string was not found in the tree)?

    List pathTo(String str) {List lst = null;if ((left != null) && (null != (lst = left.pathTo(str))))

    return lst.addFirst("L");if ((right != null) && (null != (lst = right.pathTo(str))))

    return lst.addFirst("R");return null;

    }

    List pathTo(String str) {List lst = null;if (left != null)

    return left.pathTo(str).addFirst("L");if (right != null)

    return right.pathTo(str)).addFirst("R");return null;

    }

    List pathTo(String str) {List lst = new List();if ((left != null) && (null != (lst = left.pathTo(str))))

    return lst.addFirst("L");if ((right != null) && (null != (lst = right.pathTo(str))))

    return lst.addFirst("R");return lst;

    }

    List pathTo(String str) {List lst = null;if ((left != null) && (null != (lst = left.pathTo(str))))

    return lst.addLast("L");if ((right != null) && (null != (lst = right.pathTo(str))))

    return lst.addLast("R");return null;

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    23/59

    http://worldatyou.blogspot.com/

    }

    Question Number 4

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \/ / \

    "A" + "D"

    / \/ \/ \

    "B" "C"

    One problem with the proposed implementation ofequals is that two nodes of different types

    cannot be equal. In the following code which ofTerminalNode.equals and

    InternalNode.equals correct this problem assuming the argument to each method is not null?

    (The relevant parts of the class definitions are included.)

    abstract class Node {abstract boolean isTerminal();

    abstract boolean equals(Node);}

    class TerminalNode {boolean isTerminal() {

    return true;}boolean equals(Node nd) {

    returnnd.isTerminal() && value.equals(nd.getValue());

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    24/59

    http://worldatyou.blogspot.com/

    }}

    class InternalNode {boolean isTerminal() {

    return false;}boolean equals(Node nd) {

    return!nd.isTerminal() &&left.equals(nd.getLeft()) &&right.equals(nd.getRight());

    }}

    NeitherTerminalNode norInternalNode

    TerminalNode but not InternalNode

    InternalNode but not TerminalNode

    Both TerminalNode and InternalNode

    Question Number 5

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string.

    Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \

    / \+ +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \/ \

    "B" "C"

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    25/59

    http://worldatyou.blogspot.com/

    Here is a proposed implementation ofequals for the tree structure:

    abstract class Node {abstract boolean equals(Node nd);

    }

    class TerminalNode {boolean equals(Node nd) {

    return value.equals(nd.getValue());}

    }

    class InternalNode {boolean equals(Node nd) {

    return left.equals(nd.getLeft()) &&right.equals(nd.getRight());

    }}

    Which classes contain correctly implemented methods?

    A. TerminalNode

    B. InternalNode

    Neither

    A

    B

    Both

    Question Number 6

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    26/59

    http://worldatyou.blogspot.com/

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \

    + +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \/ \

    "B" "C"

    The problem with the previous definition ofInternalNode.equals is that it calls

    nd.getLeft() and nd.getRight(), but only InternalNode defines those methods and nd

    could be a TerminalNode. The following code fixes that and will compile.

    abstract class Node {abstract boolean isTerminal();abstract boolean equals(Node);

    }

    class TerminalNode {boolean isTerminal() {

    return true;}boolean equals(Node nd) {

    returnnd.isTerminal() && value.equals(nd.getValue());

    }}

    class InternalNode {boolean isTerminal() {

    return false;}boolean equals(Node nd) {

    return!nd.isTerminal() &&left.equals(((InternalNode)nd).getLeft()) &&right.equals(((InternalNode)nd).getRight());

    }

    }

    This version of the code does not check fornull in eitherTerminalNode orInternalNode. If

    equals is called on an InternalNode with a non-null argument, which of the two methods could

    end up getting called with a null argument for certain trees?

    Both methods could ever be called with a null argument with certain trees.

    TerminalNode.equals Both methods could be called with a null argument with certain

    trees but not InternalNode.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    27/59

    http://worldatyou.blogspot.com/

    InternalNode.equals Both methods could be called with a null argument with certain

    trees but not TerminalNode.

    Neither method could ever be called with a null argument with certain trees.

    Question Number 7

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \/ / \

    "A" + "D"/ \

    / \/ \

    "B" "C"

    It is proposed to add a check fornull at the beginning of each method, returning False if the

    argument is null, since a Node object would never be equal to null. This change is shown in the

    code below. In which method(s) could nulls other than the argument be a problem?

    abstract class Node {abstract boolean isTerminal();abstract boolean equals(Node);

    }

    class TerminalNode {boolean isTerminal() {

    return true;}boolean equals(Node nd) {

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    28/59

    http://worldatyou.blogspot.com/

    returnnd != null && nd.isTerminal() && value.equals(nd.getValue());

    }}

    class InternalNode {boolean isTerminal() {

    return false;}boolean equals(Node nd) {

    returnnd != null &&!nd.isTerminal() &&left.equals(nd.getLeft()) &&right.equals(nd.getRight());

    }}

    NeitherTerminalNode.equals norInternalNode.equals they are both correct as is.

    TerminalNode.equals needs further code to deal with nulls but InternalNode.equals

    doesnt.InternalNode.equals needs further code to deal with nulls but TerminalNode.equals

    doesnt.

    Both TerminalNode.equals and InternalNode.equals need further code to deal with

    nulls.

    Question Number 8

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    29/59

    http://worldatyou.blogspot.com/

    / / \"A" + "D"

    / \/ \/ \

    "B" "C"

    We want to define an operation to get the list element at position N (with the first element is atposition 0). Which statements are correct in the following implementation?

    class SinglyLinkedList {InternalNode first;

    String nth(int n) {InternalNode nd = first;while (n-- > 0)

    nd = nd.getRight();return ((TerminalNode)(nd.getLeft())).getValue();

    }

    }The while statement (both the condition and the action) is correct.

    The return statement (taking into account all the details of the entire statement).

    There are problems with both the while and return statements.

    Both the while and return statements are correct.

    Question Number 9

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:+/ \

    / \/ \+ +/ / \

    / / \/ / \

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    30/59

    http://worldatyou.blogspot.com/

    "A" + "D"/ \

    / \/ \

    "B" "C"

    We want to define an operation to get the list element at position N (with the first element is atposition 0). Which statements are correct in the following implementation, which differs slightlyfrom the previous version?

    class SinglyLinkedList {InternalNode first;

    String nth(int n) {InternalNode nd = first;while (n-- > 0 && nd != null)

    nd = nd.getRight();return (null == nd)

    ? null

    : ((TerminalNode)(nd.getLeft())).getValue();}

    }

    The while statement (both the condition and the action) is correct.

    The return statement (taking into account all the details of the entire statement).

    There are problems with both the while and return statements.

    Both the while and return statements are correct.

    Question Number 10

    The subject of these questions is an unusually simple kind of binary tree, defined by theseproperties:

    Terminal nodes contain a string. Internal nodes have one or two children, called "left" and "right". Either child of an internal node may be null, but not both. Internal nodes contain no other information. By "tree" we simply mean a node and all of its descendants. A tree rooted at a node having left child A and right child B is a different tree than one

    rooted at a node having left child B and right child A.

    Here's an example, with plus signs (+) used to indicate internal nodes:

    +/ \

    / \/ \+ +/ / \

    / / \

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    31/59

    http://worldatyou.blogspot.com/

    / / \"A" + "D"

    / \/ \/ \

    "B" "C"

    Would the following be an adequate implement of an operation to insert a string at the front ofthe list?

    void insert(String str) {first = new InternalNode(new TerminalNode(str), first);

    }

    No, it is not always necessary to create a new TerminalNode.

    No, it is not always necessary to create a new InternalNode.

    There circumstances in which executing this method will violate the restrictions imposed onthe tree by the general specifications and the specific specifications for its use as a list.

    It is a valid implementation under all conditions.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    32/59

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    33/59

    http://worldatyou.blogspot.com/

    Computer Science Knowledge (Basic)

    Question Number 1

    A program uses a queue to visit each of the nodes of a binary tree, starting at its root. After a

    node is processed its children are added to the the end of the queue. In what order do nodes getprocessed?

    Inorder

    Postorder

    Breadth-first

    Preorder

    Question Number 2

    What features must a programming language and its runtime environment provide in order tosupport automatic memory management?

    1. Dynamic memory allocation2. Explicit deallocation of data

    3. Garbage collection

    1 and 3, but not 2

    3

    2

    1

    Question Number 3

    From the following options, select a statement that is NOT true about symbol tables.

    Symbol tables are often implemented using hash tables

    Symbol tables map the names to their attributes

    Symbol table is a compile-time data structure

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    34/59

    http://worldatyou.blogspot.com/

    Symbol table is used during syntactic analysis

    Question Number 4

    Consider an application that requires inserting and deleting data items in a data structuredynamically.

    From the following options, select an appropriate data structure for this scenario.

    Stack

    Array

    Queue

    Linked List

    Question Number 5

    Which one of the following is NOT a phase of program compilation?

    Code generation

    Parsing

    Macro expansion

    Lexical analysis

    Question Number 6

    Consider the following scenarios.

    - An operating system having a list of processes that are waiting to get access of the CPU.- A list of jobs waiting to access the printer for printing.

    From the following options, select the ideal data structure that can be used in these scenarios.

    Array

    Linked list

    Queue

    Stack

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    35/59

    http://worldatyou.blogspot.com/

    Question Number 7

    Select the decimal value of arithmetic shift right by 2 operation on a signed integer -102.

    +57

    -39

    +39

    -57

    Question Number 1

    From the following options, select the OOP mechanism, that allows treatment of the derivedclass members just like the members of their parent class.

    Encapsulation

    Polymorphism

    Abstraction

    Decoupling

    Question Number 2

    Select the option that describes a "type" in Object Oriented programming.

    It indicates the state that an object maintains

    It describes how an object implements the methods in its interface

    It defines implementation of an object

    It is an interface, which is a collection of methods that an object responds to

    Question Number 3

    Select the sorting that always has a time complexity O(n2), irrespective of the condition of thearray.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    36/59

    http://worldatyou.blogspot.com/

    Quick Sort

    Merge sort

    Selection sort

    Bubble sort

    Question Number 4

    Select the OOP concept described by the following features.

    A. Defines the abstract characteristics of a thing (object).B. Defines attributes of the thing.C. Defines the behavior of the thing.D. Represents a blueprint describing the nature of the thing.

    Class

    Function

    Method

    Instance

    Question Number 5

    Select the option that shows the correct matching between the function types and the Big Odescriptions.

    I Constant 1 O(log n)

    II Logarithmic 2 O(1)

    III Linear 3 O(n)

    IV Quadratic 4 O(n3)

    V Cubic 5 O(2n)

    VI Exponential 6 O(n2)

    (I,2),(II,1),(III,3),(IV,6),(V,4),(VI,5)

    (I,3),(II,5),(III,4),(IV,6),(V,2),(VI,I)

    (I,5),(II,6),(III,2),(IV,1),(V,4),(VI,3)

    (I,1),(II,2),(III,3),(IV,4),(V,5),(VI,6)

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    37/59

    http://worldatyou.blogspot.com/

    Question Number 6

    Select the option that denotes, "runtime is proportional to five times the input size".

    O(n5)

    5O(n)

    O(5n)

    5*O(n)

    Question Number 1

    Which one of the following is NOT a referential integrity issue in a relational database where theDEPT column of the EMPLOYEE table is designated as a foreign key into the DEPARTMENTtable?

    Inserting a new row into EMPLOYEE with a DEPT whose value is not the primary key ofany of the rows in DEPARTMENT

    Deleting a row of DEPARTMENT

    Inserting a new row into DEPARTMENT with a primary key that is not the value of theDEPT column of any row in EMPLOYEE

    Updating the value of DEPT in a row of EMPLOYEE with a value that is not the primarykey of any of the rows in DEPARTMENT

    Question Number 2

    ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100floors. The maintenance company decides to use a database to schedule work for its employeesand also check the status of the work. When an assigned housekeeper does NOT report for work,an alternate resource is allotted to complete the job.

    The Housekeeping database in its current form is given below.

    Housekeeper

    HouseKeeperIDHouseKeeperNameHouseKeeperSSNSupervisorID

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    38/59

    http://worldatyou.blogspot.com/

    Supervisor

    SupervisorIDSupervisorNameSupervisorSSN

    FloorFloorNoFloorName

    Transaction

    FloorNoDutyDateHouseKeeperIDWorkStatus

    AlternateTransaction

    FloorNoDutyDateAlternateHIDAlternateWorkSt

    Select the option that correctly lists the foreign keys for the different entities. Note that the entitynames are given in bold.

    Housekeeper SupervisorIDSupervisor HousekeeperIDTransaction HousekeeperID

    AlternateTransaction AlternateHIDHousekeeper HousekeeperSSNSupervisor SupervisorSSNTransaction HousekeeperIDAlternateTransaction AlternateHID

    Housekeeper SupervisorIDTransaction HousekeeperIDAlternateTransaction AlternateHID

    Housekeeper HousekeeperIDSupervisor SupervisorIDFloor FloorNo or FloorName

    Transaction FloorNoAlternateTransaction FloorNo

    Question Number 3

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    39/59

    http://worldatyou.blogspot.com/

    Select the option that correctly describes the database replication concept where two or morereplicas synchronize each other through a transaction identifier.

    Quorum

    Multimasterslave

    Master-Slave

    Multimaster

    Question Number 4

    You have two relation variables: RelV1 and RelV2. They are NOT necessarily distinct. Youhave a set K as a key for RelV1. Consider that FK is a subset of the heading of RelV2 thatinvolves exactly the same attributes as K.

    From the following options, select the option that correctly depicts a scenario where FK can beconsidered as a foreign key.

    Every tuple in RelV1 has a K value that is equal to the FK value in some tuple in RelV2

    Every tuple in RelV1 has a FK value that is equal to the K value in some tuple in RelV2

    Every tuple in RelV2 has a K value that is equal to the FK value in some tuple in RelV1

    Every tuple in RelV2 has a FK value that is equal to the K value in some tuple in RelV1

    Question Number 5

    Select the option that represents the I in ACID rules.

    Either all the statements in a transaction must be executed, or none of them should beexecuted

    Any two simultaneous transactions cannot obstruct each other

    The completed transactions cannot be aborted later

    Each transaction must maintain the integrity constraints of the database

    ABC Housekeeping Forces are responsible for maintaining a building that comprises of 100floors. The maintenance company decides to use a database to schedule work for its employeesand also check the status of the work. When an assigned housekeeper does NOT report for work,an alternate resource is allotted to complete the job.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    40/59

    http://worldatyou.blogspot.com/

    The Housekeeping database in its current form is given below.

    Housekeeper

    HouseKeeperIDHouseKeeperName

    HouseKeeperSSNSupervisorID

    Supervisor

    SupervisorIDSupervisorNameSupervisorSSN

    Floor

    FloorNoFloorName

    Transaction

    FloorNoDutyDateHouseKeeperIDWorkStatus

    AlternateTransaction

    FloorNoDutyDateAlternateHID

    AlternateWorkSt

    Select the option that correctly lists the single field primary keys for the various entities. Notethat the entity names are given in bold.

    Housekeeper HousekeeperIDSupervisor SupervisorIDTransaction FloorNoAlternateTransaction FloorNo

    Housekeeper HousekeeperIDSupervisor SupervisorID

    Floor FloorNoTransaction FloorNoAlternateTransaction FloorNo

    Housekeeper HousekeeperIDSupervisor SupervisorIDFloor FloorNoTransaction FloorNoAlternateTransaction AlternateHID

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    41/59

    http://worldatyou.blogspot.com/

    Housekeeper HousekeeperIDSupervisor SupervisorIDFloor FloorNo

    Question Number 7

    Select the option that represents the definition of network database model.

    Represents the entire information content of the database in only one way

    Organizes the data in the form of a tree of records, with each record having one parentrecord and many children records

    Allows each record to have multiple parent and child records, thereby forming a latticestructure

    Attempts to bring closer interactivity between database administrators and application

    programmers

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    42/59

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    43/59

    http://worldatyou.blogspot.com/

    Software Engineering AptitudeSupport ID: 14D760B

    Question Number 1

    A number when divided by 161 leaves a remainder of 57. Find the remainder if the same numberis divided by 7?

    1

    2

    5

    4

    Question Number 2

    A car travels x km at 60 km/hr and another 3x km at 90 km/hr. Find its average over the entiredistance?

    80 km/hr

    72 km/hr

    84 km/hr

    75 klm/hr

    Question Number 3

    Provisions are available for a battalion of 2000 soldiers for 35 weeks at the rate of 16 kgs per day

    per person. If some more soldiers join the battalion, the provisions would last for 20 weeks at therate of 20 kgs per day per person. Find the number of soldiers joining the battalion?

    200

    800

    1000

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    44/59

    http://worldatyou.blogspot.com/

    400

    Question Number 4

    In an organization, if there 24 more executives, then the number of executives will be three timesthe number of managers. If there are two more managers, then the number of executives will betwice the number of managers. What is the number of executives?

    60

    48

    36

    72

    Question Number 5

    The price of sugar is increased by 12% and the consumption is decreased by 8%. The net changein the expenditure on this account is __________.

    3.04% increase

    3.04% decrease

    4 % increase2.64 % decrease

    Question Number 6

    Find the probability that a number selected at random from the first 25 natural numbers isdivisible by 2 or 5?

    2/5

    3/5

    1/6

    17/25

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    45/59

    http://worldatyou.blogspot.com/

    Question Number 7

    A man rows downstream and covers 15 km in 3 hours. He covers the same distance upstream in

    5 hours. What is the difference in the distance traveled upstream in six hours and that traveleddownstream in six hours?

    12 km

    6 km

    4 km

    2 km

    Question Number 8

    Two pipes A and B can fill a tank in 6 hours and 4 hours respectively. If A is opened first, andthe pipes are opened alternately for one hour each, in how many hours will the tank be full?

    4 h

    5 h

    5.5 h

    4.5 h

    A sum of US $ 30000 is invested is a bank at 12% interest p.a. compounded semi-annually. Afterone and half year it will amount to __________.

    US $ 36620.10

    US $ 36120.30

    US $ 35320.20US $ 35730.48

    Question Number 10

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    46/59

    http://worldatyou.blogspot.com/

    A is directly proportional to B when C is constant and inversely proportional to the square of Cwhen B is constant. In a particular instance when A = 18, B = 25 and C = 10, find A if C = 9 andB = 18.

    24

    12

    16

    32

    Question Number 1

    The speed of a boat in still water is S. The speed of the current is C. Which of the following

    expressions best represents the total time taken by the boat to cover a distance D between twopoints named A and B, both ways, that is with and against the current?

    D/2S

    2D/S

    D/(S+C) + D/(S-C)

    (A-B)/(S+C) + (B-A)/(S-C)

    At a salad bar, the cost of a meal is a fixed amount of $X, plus $Y per item selected from a menuof extra items. Six friends eat at the salad bar, selecting 17 extra items. Only four of them pay theentire bill by splitting it equally. The amount to be paid by each person paying the bill is__________.

    X + Y

    (6X + 17Y) / 4

    (6X+6Y) / 4

    (6X + 17Y) / 6

    Question Number 3

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    47/59

    http://worldatyou.blogspot.com/

    The problem below contains a question and two statements labeled A and B that give datapertaining to the question. Determine whether the information given in statements A and B issufficient to answer the question, and select the correct answer from the given options.

    What is Stans age?

    A. Stans age in 12 years will be twice what it was 8 years ago

    B. Stans son was born four years ago and will be half Stans age in 20 years.

    The question can be answered by using one of the statements alone but not the other

    The question can be answered by using either statement alone

    The question can be answered by using both the statements together, but not by using eitherstatement alone

    Neither of the statements, individually or jointly, provides sufficient data to answer the

    question

    N mules carry loads averaging X kilograms (kgs) each. M mules are added to the group, and theaverage weight carried by the expanded group goes up by Y%. What is the average weight in kgscarried by the added mules?

    ( X*(1+0.01Y)(N-M) MX ) / M

    ( X*(1+0.01Y)(N-M) NX ) / M

    ( X*(1+0.01Y)(N+M) MX ) / M

    ( X*(1+0.01Y)(N+M) NX ) / M

    Question Number 5

    The problem below contains a question and two statements labeled A and B that give datapertaining to the question. Determine whether the information given in statements A and B is

    sufficient to answer the question, and select the correct answer from options 1-4.

    1. The question can be answered by using one of the statements alone but not the other.

    2. The question can be answered by using either statement alone.

    3. The question can be answered by using both the statements together, but not by using eitherstatement alone.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    48/59

    http://worldatyou.blogspot.com/

    4. Neither of the statements, individually or jointly, provides sufficient data to answer thequestion.

    Pipes X, Y and Z flow at different rates and together take 24/13 minutes to fill a bucket. What isthe time taken by Y and Z together to fill the bucket?

    A. The time taken by X & Y is 12/5 minutes

    B. The time taken by X & Z is 8/3 minutes

    1

    2

    3

    4

    Question Number 6

    An airline assumes that on average each passenger weighs x pounds. It also assumes that 80% ofpassengers will have luggage which on average weighs y pounds. In addition to passengers, eachairplane carries freight and the airline assumes that each container weighs z pounds. How wouldyou calculate the expected weight of a plane scheduled to carry P passengers and F containers offreight.

    0.8Px + Py + Fz

    0.8(Px + Py) + Fz

    P(x + .8y)Fz

    P(x + .8y) + Fz

    Question Number 7

    The problem below contains a question and two statements labeled A and B that give datapertaining to the question. Determine whether the information given in statements A and B issufficient to answer the question, and select the correct answer from options 1-4:

    1. The question can be answered by using one of the statements alone but not the other.

    2. The question can be answered by using either statement alone.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    49/59

    http://worldatyou.blogspot.com/

    3. The question can be answered by using both the statements together.

    4. Neither of the statements, individually or jointly, provide sufficient data to answer thequestion.

    20 men take 3 hours to build a wall. How long does it take for 15 women to build the wall?

    A. A woman works at half the pace of a manB. 5 men and 10 women can build the wall in 6 hours

    1

    2

    3

    4

    Question Number 8

    An article is sold after giving discounts of D1% and D2% on the marked price $MRP. What isthe profit percentage earned by the article on its cost price $CP?

    100*( (1 0.01D1) (1-0.01D2) * CP MRP ) / CP

    100 * ( (1 0.01D1) (1 0.01D2) * CP MRP ) / MRP

    100 * ( (1 0.01D1) (1 0.01D2) * MRP CP ) / CP

    100 * ( (1 0.01D1) (1 0.01D2) * MRP CP ) / MRP

    Question Number 9

    The problem below contains a question and two statements labeled A and B that give datapertaining to the question. Determine whether the information given in statements A and B is

    sufficient to answer the question, and select the correct answer from options 1-4.

    1. The question can be answered by using one of the statements alone but not the other.

    2. The question can be answered by using either statement alone.

    3. The question can be answered by using both the statements together.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    50/59

    http://worldatyou.blogspot.com/

    4. Neither of the statements, individually or jointly, provides sufficient data to answer thequestion.

    Is the average speed of a cheetah more than 70 km/h?

    A. The cheetah covered the distance of 3 kms in two minutes

    B. In the second minute the cheetah ran at half the speed in the first minute

    1

    2

    3

    4

    Question Number 10

    The problem below contains a question and two statements labeled A and B that give datapertaining to the question. Determine whether the information given in statements A and B issufficient to answer the question, and select the correct answer from options 1-4.

    1. The question can be answered by using one of the statements alone but not the other.

    2. The question can be answered by using either statement alone.

    3. The question can be answered by using both the statements together.

    4. Neither of the statements, individually or jointly, provides sufficient data to answer thequestion.

    In a particular class, each student studies Psychology, Sociology, or both subjects. How manystudents study only Sociology?

    A. 30 students study Psychology and 25 students study Sociology

    B. The class has 50 students, and 5 students study both subjects

    1

    2

    3

    4

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    51/59

    http://worldatyou.blogspot.com/

    Question Number 1

    Based on the data in the following table, answer the question below it.

    Which one of the following is the correct combination of Part Number and Part Name in thetable?

    Arrow Shirt Cotton sleeves Red stripes Size-42 & 451-TET-KLVB64-154AA/36

    Denim Jeans Gents Blue Size 40 & 231-PLK-SEHT96-236AS/62

    Killer Jeans Ladies Stretchable Black Size 34 & 125-LKJ-LKEFT55-111VV/18

    Denim Jeans Gents Blue Size 40 & 510-TRT-LDKG21-652PF/23

    Question Number 2

    Based on the data in the following table, answer the question below it.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    52/59

    http://worldatyou.blogspot.com/

    The correct credit card details of the customer Fowler, Heather are __________.

    4532343207436130

    4532343204736130

    4532343204736310

    4532343204763130

    Question Number 3

    Based on the data in the following table, answer the question below it.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    53/59

    http://worldatyou.blogspot.com/

    Which one of the following is NOT a correct Customer Detail?

    2371 Heritage Road, Fresno, CA 93721 10-07-58

    2136 Clinton Street, Philadelphia, PA 19108 04-02-52

    2291 Melody Lane, Richmond, VA 23324 12-05-59

    119 Ridenour Street, Miramar, FL 33025 12-08-50

    Question Number 4

    Based on the data in the following table, answer the question below it.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    54/59

    http://worldatyou.blogspot.com/

    The correct details of the customer Truelove, James is __________.

    605-882-2787 4/13/1956

    605-822-2877 4/13/1956

    605-822-2787 4/13/1956

    605-822-2787 4/13/1965

    uestion Number 1

    Please carefully read the following:

    The following flowchart computes the sum of the squares of all primes between 1 and Ninclusive.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    55/59

    http://worldatyou.blogspot.com/

    What is the value of Cell 1?

    Is X = N?

    Is X < N?

    Is X > N?

    Is X > TEMP?

    Question Number 2

    Please carefully read the following:

    The following flowchart computes the sum of the squares of all primes between 1 and N

    inclusive.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    56/59

    http://worldatyou.blogspot.com/

    What is the value of Cell 4?

    TEMP = TEMP 1

    TEMP = TEMP + 1

    X = X + 1

    X = X 1

    Question Number 3

    Please carefully read the following:

    The following flowchart computes the sum of the squares of all primes between 1 and Ninclusive.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    57/59

    http://worldatyou.blogspot.com/

    What is the value of Cell 5?

    X = X 1

    X = X + 1

    TEMP = TEMP 1

    TEMP = TEMP + 1

    Question Number 4

    Please carefully read the following:

    The following flowchart computes the sum of the squares of all primes between 1 and N

    inclusive.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    58/59

    http://worldatyou.blogspot.com/

    What is the value of Cell 3?

    DIV = N / TEMP

    DIV = N / X

    DIV = TEMP / X

    DIV = X / TEMP

    Question Number 5

    Please carefully read the following:

    The following flowchart computes the sum of the squares of all primes between 1 and N

    inclusive.

    http://worldatyou.blogspot.com/

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/
  • 8/3/2019 67976648 Complete Oracle Paper

    59/59

    http://worldatyou.blogspot.com/

    What is the value of Cell 2?

    TEMP = 0

    TEMP = 1

    TEMP = 2

    TEMP = TEMP + 1

    http://worldatyou.blogspot.com/http://worldatyou.blogspot.com/

Recommended