Professional Documents
Culture Documents
2) Which of the following properties of algorithms states that each step in an algorithm is unambiguous.
- Effectiveness
- Definiteness
- Efficiency
- Finiteness
3) Joe is assigned a task to develop a code to implement a delete operation on a stack implemented in
the form of a linked list. Identify the correct algorithm that would enable him to accomplish this task.
- Queues
- Linked List
- Trees
- Stacks
6) Jim is assigned a task to develop a code to display all the elements in a circular linked list. Identify the
correct algorithm that would enable him to accomplish this task.
- 1 . Make currentNode point to the successor of the node marked as LAST, such that currentNode
points to the first node in the list.
2.Repeat step 3 and 4 until currentNode = LAST.
3.Display the information contained in the node marked as currentNode.
4.Make currentNode point to the next node in its sequence.
5.Display the information contained in the next field of node marked as LAST.
- 1 . Make currentNode point to the successor of the node marked as LAST, such that currentNode
points to the first node in the list.
2.Repeat step 3 and 4 until the next field of currentNode = LAST.
3.Display the information contained in the node marked as currentNode.
4.Make currentNode point to the next node in its sequence.
5.Display the information contained in the node marked as LAST.
- 1 . Make currentNode point to the successor of the node marked as LAST, such that currentNode
points to the first node in the list.
2.Repeat step 3 and 4 until currentNode = LAST.
3.Display the information contained in the node marked as currentNode.
4.Make currentNode point to the next node in its sequence.
5.Display the information contained in the node marked as LAST.
- 1 . Make currentNode point to the successor of the node marked as LAST, such that currentNode
points to the first node in the list.
2.Repeat step 3 until currentNode = LAST.
3.Display the information contained in the node marked as currentNode.
4.Display the information contained in the node marked as LAST.
5.Make currentNode point to the next node in its sequence.
7) Henry has written a code to sort a given list of items using insertion sort. When the code is executed,
the user enters a list of 10 elements in the reverse order. How many comparisons will be made in the
first pass?
- 10
- 1
- 11
- zero
8) Jim has written the following algorithm to insert a node at the end of a singly-linked list.
1.Allocate memory for the new node.
2.Assign value to the data field of the new node.
3.If START is NULL, then:
a. Make START point to the new node.
b. Make LAST point to the new node.
c. Go to step 6.
4.Mark the new node as LAST.
5.Make the next field of LAST point to the new node.
6.Make the next field of the new node point to NULL.
However, the given algorithm does not give the desired output. Identify the reason and provide the
correct solution.
- In step 6, the next field of new node should be made to point to LAST.
- The given algorithm will evaluate the infix expression. Consider the following statements:
Which one of the following options is correct with respect to the above statements?
- Spanning Subgraph
- Complete Graph
- Acyclic Graph
- Connected Graph
Which one of the following options is correct with respect to the above
statements?
- Truncation Method
- Modular Method
- Folding Method
15) Kim is working with Royal Inc. as a data analyst. She has been
provided with a list of products, the company deals with. She is
required to sort the list.
The sorting algorithm adopted by her is as follows:
- Merge Sort
- Bubble Sort
- Quick Sort
- Selection Sort
- 12
- 78
-11
- 66
Which one of the following option is correct with respect to the above
statements?
19) The given algorithm deletes a node between the two nodes in a
singly-linked list.
- Step e should be replaced by: Make current point to the next node
in sequence.
The data structure matches the schema but there are errors in the
code. Identify the errors.
21) Which of the following sorting techniques will you use, if the list to
be sorted is small in size and is nearly sorted?
- Insertion Sort
- Bubble Sort
- Selection Sort
- Quick Sort
22) <HTML>
<head>
<title>Link the Docurnents</title>
<body>
<A href ="javascript: hi story(2)j">
<IMG BORDER = 0 src= "arrow.gif>
</A>
</body>
</head>
</HTML>
<HTML>
<head>
<title>Link the Docurnents</title>
<body>
<A href ="javascript:history.next(2)/> <IMG
BORDER = 0 src= "arrow.gif > </A> </body>
</head> </HTML> 3 <HTML> <head>
<title>Link the Docurnents</title>
<body>
<A href ="history.go(2);"> <IMG BORDER = 0
src = "arrow.gif > </A> </body> </head>
</HTML> 3 <HTML> <head>
<title>Link the Docurnents</title>
<body>
<A href =ijavascript:historY.go(2);">
<IMG BORDER = 0 src= "arrow.gif >
</A>
</body>
</head>
</HTML>
Identify the correct tags for inserting JavaScript code in an HTML code.
- <SCRIPT ="JavaScript">
</SCRIPT>
- <SCRIPT>
< LAN G U AG E="J avaS c h
pt" > </SCRIPT>
- <JavaScript SCRIPT>
</SCRIPT>
- <SCRIPT LANGUAGE="JavaScript">
</SCRIPT>
lll)You can use the DOMDocument object to load the schema document
associated with the XML document.
3 1,11
and III 3 II
and III I
and III
I and II
i
n
J
)
The code has the following errors:
1.The value for testing the length of the child note is incorrect. The
test condition should check the length to be greater than 0.
2.The parameters passed in the createNode function are incorrect.
The correct function implementation is createNode(l," StudentGroup
")
Sorting content 3
Implementing filters 3 Creating
labels and headings 3 Specifying
attributes for entities
3 The given algorithm will not give the desired output because step
3(a)(ii) is incorrect.
3 The given algorithm will not give the desired output because step
3(a)(iii) is incorrect.
3 The given algorithm will not give the desired output because step
3(a)(i) is incorrect.
Which of the following symbol is used to display the less than (<)
symbol?
3 It;
3
alt;
-ait
-it
1
3 4
3 3
The following is the algorihtm to search for a particular value in a
binary search tree:
1.Make currentNode point to NULL
2.If currentNode is not NULL:
a. Display "Not found"
b. Exit
3. Compare the value to be searched with the value of currentNode.
Depending on the result of the comparison, there can be three
possibilities:
a. If the value is equal to the value of currentNode:
i. Display "Found"
ii. Exit
b. If the value is less than the value of currentNode:
i. Make currentNode point to its left child
ii. Go to step 2
c. If the value is greater than the value of currentNode:
i. Make currentNode point to its right child
ii. Go to step 2
However, the given algorithm does not give the desired output.
Identify the error?
3 1 . Identify the node for which you need to locate the inorder
successor, and mark it as currentNode.
2. Ifthe right child of currentNode is athread:
a. Mark the right child of currentNode as successor.
b. Exit.
3.Make currentNode point to its left child.
4.Repeat step 5 until the left child of currentNode becomes a
thread.
5.Make currentNode point to its left child.
6.Mark currentNode as successor.
3 1 . Identify the node for which you need to locate the inorder
successor, and mark it as currentNode.
2. Ifthe right child of currentNode is athread:
a. Mark the right child of currentNode as successor.
b. Exit.
3.Make currentNode point to its right child.
4.Repeat step 5 until the left child of currentNode becomes a
thread.
5. Make currentNode point to its right child.
5. Mark currentNode as successor.
3 1 . Identify the node for which you need to locate the inorder
successor, and mark it as currentNode.
2. Ifthe right child of currentNode is athread:
a. Mark the right child of currentNode as successor.
b. Exit.
3.Make currentNode point to its right child.
4.Repeat step 5 until the left child of currentNode becomes a
thread.
5.Make currentNode point to its left child.
6.Mark currentNode as successor.
3 1 . Identify the node for which you need to locate the inorder
successor, and mark it as currentNode.
2. Ifthe left child of currentNode is athread:
a. Mark the left child of currentNode as successor.
b. Exit.
3.Make currentNode point to its right child.
4.Repeat step 5 until the left child of currentNode becomes a
thread.
5.Make currentNode point to its left child.
6.Mark currentNode as successor.
3 <EMPLOYEEempid="eOr>
<EMPNAME> James Peterson<BASICPAY> $2000
</EASICPAYx/EMPNAME> </EMPLOYEE>
3 <EMPLOYEEempid="e01">
<EMPNAME> James Peterson<EASICPAY> $2000 </EMPNAME>
</EASICPAY>
</EMPLOYEE>
3 Address of the
current node 3
Address of the first
3 Constant
og
Li
ne
ar
3
Ex
po
ne
nt
ial
5
Lo
ga
rit
ic
node.
" Stack 3
Trees
Queue 3
Linked List
Arrays
3 Trees
3
Queues "
Stacks
3 The given algorithm will delete a node from the end of a circular
linked list.
3 The given algorithm will delete a node between the two nodes of
a doubly-linked list or a node at the end of a doubly-linked list.
3 10
3 17
3 18
3 19
Sam has developed a code to delete a node between the two nodes
from a singly-linked list according to the following algorithm:
1. Locate the node to be deleted. Mark the node to be deleted as
current and its predecessor as previous. To locate current and
previous, execute the following steps:
a. Set previous = START.
b. Set current = START.
c. Repeat steps d until either the node is found or current
becomes NULL.
d. Make previous point to current.
e. Make current point to the next node in sequence.
2.Make the next field of previous point to the successor of current.
3.Release the memory for the node marked as current.
NULL
Zero
3 Acyclic Graph
3 Spanning Subgraph
Connected Graph
3 Complete Graph
3 1. Set pass = 1.
2.Repeat step 3 varying j from 0 to n - 1 - pass.
3.Ifthe element at index j is greater than the element at index j
+ 1,
swap the two elements.
4.Increment pass by 1.
5.If pass <= n - 1 go to step 2.
3 1. Set pass = 1.
2.Repeat step 3 varying j from 0 to n - 1.
3.Ifthe element at index j is greater than the element at Index j
+ 1, swap the two elements.
4.Increment pass by 1.
5.If pass <= n - 1 go to step 2.
J 1. Set pass = 1.
2.Repeat step 3 varying j from 0 to n - 1 - pass.
3.If the element at index j is greater than the element at index
j + 1,
swap the two elements.
4.Increment pass by 1.
5.If pass <= n go to step 2.
3 1. Set pass = 0.
2.Repeat step 3 varying j from 0 to n - 1 - pass.
3.If the element at index j is greater than the element at index
j + 1, swap the two elements.
4.Increment pass by 1.
5.If pass <= n - 1 go to step 2.
3 1
3
3 Modular
Method 3
Folding Method 3
Truncation
Method 3 Mid
Square Method
Kim is working with Royal Inc. as a data analyst. She has been
provided with a list of products, the company deals with. She is
required to sort the list.
The sorting algorithm adopted by her is as follows:
Merge Sort
Selection
Sort 3
Bubble Sort
How many comparisons are required to sort an array of 8 elements
by using insertion sort, when the list is already sorted?
3
28
3
8 3
64 -
Merge Sort
Selection Sort
2Quick Sort
3Insertion Sort
is false
E is true
The given algorithm will insert a node at the end of the doubly-
linked list.
3
Hierarch
y 3
Sequenc
e 3
Web 3
Grid
Which of the following statements will you use to ensure that the
script waits till the XML document gets completely loaded before
continuing with the other code?
3 xmldoc.async = false
xmldoc.readystate =
false 3 xmldoc.async =
true
xmldoc.readystate = 4
The following code is used to generate a comma separated value
listing of the STUDENTS and STUDENTID elements.
<xsl:ternplate rnatch=7">
<xsl:for-each select="STUDENTS/STUDENT">
<xsl:for-each select="STUDENTID">
<xsl:if test ="positionQ = =0"> , </xsl:if>
<xsl:value-of select="/" />
<xsl:value-of select="/" />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
Boolean functions
3 Character functions
3 Node-set functions
Numeric functions
Character
Mixed 3
Element 3
Null
history.go hi
story.forward
history.current 3
history.back
Identify the type of content of the EMP element in the following XML
code fragment. <COMPDETAILS> <EMP>Marketing Executive
<EMP_ID>EMPQ01 </EMP_ID>
<EMP_N AME>Robert Wi 11 i am
s</EMP_NAME> </EMP>
</COMPDETAILS
> 3 Element
content 3 Data
content
Mixed content
Em pty
Which of the following statements is correct for XML? Statement A:
XML is a text-based markup language that enables you to store data
in a structured format by using meaningful tags. Statement B: XML
allows you to present data as per the requirements of the
application.
time