technical_training
technical_training
1. Type field in IEEE 802.3 (wired ethernet) frame format is used for
A) Multiplexing
B) De-multiplexing
C) Both
D) None
ANSWER: C
Explanation: Layer 2 has to handle more than one protocol ans layer 3 - IPv4,IPv6.
Multiplexing required when host transmits and de-multplexing when host receives data
A) 12 hex digits
B) 8 hex digits
C) 4 hex digits
D) 32 hex digits
ANSWER: A
A) LAN
B) WAN
C) WLAN
D) All
ANSWER: D
Explanation: All are data communication networks and use packet switching
4. CSMA/CD needed in
A) Bus topology
ANSWER: A
5. The protocol used to dynamically bind an IPv4 address to a hardware (MAC) address
A) ARP
B) TCP
C) UDP
D) IPv4
ANSWER: A
A) TCP/IP layer 2, 3
B) TCP/IP layer 1, 2
C) TCP/IP layer 1 , 3
D) All 5 layers
ANSWER: B
Explanation: Layer 1 and 2 only. Layer 1 - wireless vs wire , layer 2 frame formats differ
7. WiFi depoloyment in campus uses
A) Infrastructure mode
C) Adhoc mode
ANSWER: B
Explanation: Has APs and internet connectivity thru wired LAN / Router. AP- AP thru wired
LAN
A) Wireless interface
B) Wired interface
C) Both
D) None
ANSWER: C
Explanation:Wireless interface for stations and wired interface to connect to wired LAN
A) Control
B) Data
C) Management
D) All
ANSWER: D
Explanation: All
10. WiFi provides
A) Authentication
C) Deauthentication
D) All
ANSWER: D
11. Two sites of an organization have set up a VPN. This VPN uses
C) Transport or tunnel
D) None
ANSWER: B
A) TLS
B) IPSec
C) SCTP
D) DNS
ANSWER: A
A) Source address
B) destination address
C) proto
D) All of above
ANSWER: D
14. in IPsec transport mode, the correct order for layers (top down)
D) None
ANSWER: A
A) Authentication
B) encryption
C) Both
D) None
ANSWER: C
A) IP address
B) MAC address
C) Mask
ANSWER: D
A) ITU-T
B) IETF
C) IEEE
D) ETSI
ANSWER: B
A) SDN
B) NFV
C) IOT
D) Cloud
ANSWER: A
B) Source ip
C) destination ip
D) All
ANSWER: D
A) SDN
B) NFV
C) IOT
D) CLOUD
ANSWER: B
21. HTTP
ANSWER: B
A) MGCP
B) MEGACO
C) SIP
D) H.323
ANSWER: C
A) RTP
B) RTCP
C) BOTH
D) SDP
ANSWER: A
Explanation: Real-time transport protocol. RTCP used as companion protocol (out of band
data)
ANSWER: A
C) Both
D) None
ANSWER: C
A) Little endian
B) Big endian
ANSWER: B
A) Sequential server
B) Concurrent server
ANSWER: B
A) client application
B) server application
C) Both
ANSWER: C
A) TCP server
B) UDP server
C) TCP client
D) UDP client
ANSWER: C
A) Socket function
B) accept function
C) Both
ANSWER: C
A) 32 bits
B) 64 bits
C) 16 bits
D) 128 bits
ANSWER: A
EXPLANATION: 32 bits
A) Multiplexing
B) De-multiplexing
C) Both
D) None
ANSWER: C
Explanation: Layer 4 has more than on protocol. Multiplexing required when host transmits
and de-multplexing when host receives data
A) Connectionless
C) Both
D) None
ANSWER: C
A) Destination host
ANSWER: A
Explanation: Fragmentation by routers along the path if required and reassembly by
Destination host
35. Subnetting allows connecting multiple physical networks (LANs) in a site to internet using
single net id
A) False
B) True
ANSWER: B
A) True
B) False
ANSWER: A
A) False
B) True
ANSWER: B
A) 32 bits
B) 128 bits
C) 48 bits
D) 16 bits
ANSWER: B
ANSWER: B
ANSWER: C
EXPLANATION: Link-local address formed during boot time and anycast also new in IPV6
C. Both A and B
ANSWER:A
A. 32 bits
B. 128 bits
C. 16 bits
D. 48 bits
ANSWER:16
EXPLANATION: 16 bits
ANSWER:B
EXPLANATION: TCP is byte oriented and seq number is for first byte in a segment
A. FLOW Control
B. CONGESTION handling
D. All of above
ANSWER:D
45. TCP segment header field used for flow control and congestion handling
A. WINDOW
B. HLEN
C. URGENT POINTER
D. SOURCE PORT
ANSWER: A
A. False
B. TRUE
ANSWER:A
B. WEB browsing
C. Email
D. FTP
ANSWER:A
A. WEB BROWSING
C. DNS
D. SNMP
ANSWER:A
49. Pseudo header used for TCP/UDP checksum computaion is transmitted on the network
A. False
B. True
ANSWER:A
A. Ack number
B. Ack bit
C. Both needed
ANSWER:C
DBMS MCQs
A) Delete
B) Update
C) Get
D) Select
ANSWER: D
2.What does SQL stand for
D) None of these
ANSWER: B
A) INSERT
B) SELECT
C) DELETE
D) None of these
ANSWER: A
A) SELECT
B) UPDATE
C) DELETE
D) None of these
ANSWER: B
5.Which of the following SQL statements is used to retrieve data from a database?
A) DELETE
B) UPDATE
C) SELECT
D) INSERT
ANSWER: C
6.Which of the following SQL clauses is used to specify the conditions that must
be met to retrieve data from a database?
A) ORDER BY
B) GROUP BY
C) WHERE
D) HAVING
ANSWER: C
7.Which of the following SQL statements is used to add new data to a database?
A) DELETE
B) SELECT
C) UPDATE
D) INSERT
ANSWER: D
8.Which of the following SQL functions is used to count the number of rows in a
table?
A) COUNT
B) AVG
C) MAX
D) MIN
ANSWER: A
9.Which of the following SQL statements is used to delete data from a database?
A) INSERT
B) DELETE
C) UPDATE
D) SELECT
ANSWER: B
10.Which of the following SQL clauses is used to sort the retrieved data in
ascending or descending order?
A) GROUP BY
B) ORDER BY
C) WHERE
D) HAVING
ANSWER: B
11.Which of the following SQL functions is used to find the highest value in a
column?
A) COUNT
B) AVG
C) SUM
D) MAX
ANSWER: D
12.Which of the following SQL clauses is used to group the retrieved data by one
or more columns?
A) ORDER BY
B) GROUP BY
C) HAVING
D) WHERE
ANSWER: B
13.Which of the following SQL functions is used to calculate the average value in
a column?
A) COUNT
B) MAX
C) AVG
D) SUM
ANSWER: C
A) SELECT DISTINCT
B) SELECT UNIQUE
C) SELECT ALL
D) SELECT DUPLICATE
ANSWER: A
15. Which SQL function is used to return the current date and time?
A) GETDATE()
B) CURRENT_TIMESTAMP()
C) NOW()
D) SYSDATE()
ANSWER: B
16.Which SQL keyword is used to sort the result set in descending order?
A) ORDER BY DESC
B) ORDER BY ASC
C) SORT BY DESC
D) SORT BY ASC
ANSWER: A
A) UNION
B) JOIN
C) INTERSECT
D) EXCEPT
ANSWER: B
A) SELECT
B) DISTINCT
C) UNIQUE
D) GROUP BY
ANSWER: B
A) UPDATE
B) DELETE
C) INSERT INTO
D) ALTER TABLE
ANSWER: C
A) GROUP BY
B) JOIN
C) UNION
D) WHERE
ANSWER: B
21.Which SQL function is used to return the current date and time?
A) NOW()
B) DATE()
C) TIME()
D) YEAR()
ANSWER: A
A) NOT
B) OR
C) AND
D) LIKE
ANSWER: C
A) DESC
B) ORDER BY
C) ASC
D) SORT
ANSWER: C
A) AND
B) OR
C) NOT
D) XOR
ANSWER: A
A) TOP
B) LIMIT
C) ROWS
D) COUNT
ANSWER: B
26.What is the command used to calculate the average value of a column in SQL?
A) SELECT MAX()
B) SELECT COUNT()
C) SELECT AVG()
D) NONE OF THESE
ANSWER: C
A) TRUNCATE DATA
B) TRUNCATE TABLE
C) TRUNCATE DATABASE
D) TRUNCATE ROW
ANSWER: B
D) NONE OF THESE
ANSWER: B
A) DELETE
B) ORDER BY
C) INSERT
D) SORT
ANSWER: B
A) ALTER ROW
B) ALTER COLUMN
C) ALTER TABLE
D) NONE OF THESE
ANSWER: C
A) DROP ROW
B) DROP COLUMN
C) DROP TABLE
D) DELETE TABLE
ANSWER: C
A) Create data
B) Create table
C) Add table
D) Add data
ANSWER: B
A) Order By
B) Where
C) Delete
D) Insert
ANSWER: B
34.Which SQL keyword is used to group rows based on the values in a particular
column?
A) Order By
B) Delete
C) Group By
D) Insert
ANSWER: C
35.Which SQL operator is used to select rows that meet either of two conditions in
a WHERE clause?
A) AND
B) OR
C) Order By
D) Group By
ANSWER: B
A) Count
B) Max
C) ASC
D) Avg
ANSWER: D
B) Min
C) Large
D) None of these
ANSWER: B
ANSWER: A
A) ORDER BY column_name;
B) SORT BY column_name;
C) ARRANGE BY column_name;
D) SEQUENCE BY column_name;
ANSWER: B
ANSWER: B
ANSWER: C
A) Oracle
B) MongoDB
C) Cassandra
D) Redis
ANSWER: A
B) Delete Table
C) Erase Table
D) Drop Table
ANSWER: D
A) Create Table
B) Insert Table
C) Add Table
D) Make Table
ANSWER: A
45.Which SQL statement is used to sort the result set in ascending order?
A) Order ASC
B) Order by ASC
C) Order DESC
D) Order by DESC
ANSWER: B
B) Update
C) Delete
D) Select
ANSWER: B
A) Add
B) Insert
C) Update
D) Select
ANSWER: D
48.Which SQL statement is used to limit the number of results returned from a
query?
A) Fetch
B) Count
C) Limit
D) Top
ANSWER: C
49.Which SQL statement is used to select only unique values from a table?
A) Select Unique
B) Select Distinct
C) Select Different
ANSWER: B
50.What will be the output of the below LIKE query? WHERE SALARY LIKE
'9000%'
ANSWER: A
51.What will be the output of the below LIKE query? WHERE SALARY LIKE
'8_%_%.'
ANSWER: A
52.Select all records from the Employees table where the Phone_number is
empty.The query is--- SELECT * FROM Employees WHERE _________
A) Phone_number IS NULL.
B) Phone_number IS EMPTY.
ANSWER: A
53.Write a query to retrieve the employee’s first name and last name and
concatenate them in a single column?
ANSWER: A
54.If we don’t specify ASC or DSC after the ORDER BY command, which of the
following is used by default?
A) ASC
B) DSC
55.Write a query to retrieve the employee’s first name and last name and
concatenate them in a single column?
ANSWER: A
A) Steve Jobs
B) James Gosling
C)Dennis Ritchie
D)Rasmus Lerdorf
ANSWER: C
2. Which of the following is not a valid C variable name?
A) int number;
B) float rate;
C)int variable_count;
D)int $main;
ANSWER: D
A) LowerCase letters
B) UpperCase letters
C)CamelCase letters
ANSWER: A
ANSWER: C
ANSWER: B
A) volatile
B) true
C)friend
D)export
ANSWER: A
ADVERTISEMENT
B) Qualifier
ANSWER: C
A) String str;
B) char *str;
ANSWER: A
9. Which keyword is used to prevent any changes in the variable within a C program?
A) immutable
B) mutable
C)const
D)volatile
ANSWER: C
A) True or False
B) 0 or 1
ANSWER: B
A) Widening conversions
B) Narrowing conversions
ANSWER: C
ANSWER: C
A) for
B) while
C)do-while
ANSWER: D
A) true
B) false
ANSWER: A
A) Internal
B) External
ANSWER: B
ANSWER: C
18. Property which allows to produce different executable for different platforms in C is called?
A) File inclusion
B) Selective inclusion
C)Conditional compilation
D)Recursive macros
ANSWER: C
A) Preprocessor directive
B) Inclusion directive
ANSWER: A
20. C preprocessors can have compiler specific features.
A) True
B) False
ANSWER: A
A) #ifdef
B) #define
C)#endif
ANSWER: D
A) #
B) $
C)” ”
D)&
ANSWER: A
23. How is search done in #include and #include “somelibrary.h” according to C standard?
A) When former is used, current directory is searched and when latter is used, standard
directory is searched
B) When former is used, standard directory is searched and when latter is used, current
directory is searched
C)When former is used, search is done in implementation defined manner and when latter is
used, current directory is searched
ANSWER: B
24. How many number of pointer (*) does C have against a pointer variable declaration?
A) 7
B) 127
C)255
D)No limits
ANSWER: D
A) Jagged Array
B) Rectangular Array
C)Cuboidal Array
D)Multidimensional Array
ANSWER: A
A) char *
B) struct
C)void
27. The standard header _______ is used for variable list arguments (…) in C.
A) <stdio.h >
B) <stdlib.h>
C)<math.h>
D)<stdarg.h>
ANSWER: D
28. When a C program is started, O.S environment is responsible for opening file and
providing pointer for that file?
A) Standard input
B) Standard output
C)Standard error
ANSWER: D
A) int
B) char *
C)struct
ANSWER: C
A) 1 bit
B) 2 bits
C)1 Byte
D)2 Bytes
ANSWER: C
A) ,
B) sizeof()
C)~
ANSWER: D
A) stdlib. h
B) ctype. h
C)stdio. h
D)stdarg. h
ANSWER: C
A) Attach
B) Append
C)Apprehend
D)Add
ANSWER: B
34. What will be the output of the following C code?
1. #include <stdio.h>
2. int main()
3. {
4. int y = 10000;
5. int y = 34;
7. return 0;
8. }
B) Hello World! 34
ANSWER: A
1. #include <stdio.h>
2. int main()
3. {
4. int main = 3;
5. printf("%d", main);
6. return 0;
7. }
ANSWER: C
1. #include <stdio.h>
2. int main()
3. {
5. chr = 128;
6. printf("%d\n", chr);
7. return 0;
8. }
A) 128
B) -128
ANSWER: B
37. What will be the output of the following C code on a 64 bit machine?
1. #include <stdio.h>
2. union Sti
3. {
4. int nu;
5. char m;
6. };
7. int main()
8. {
9. union Sti s;
11. return 0;
12. }
A) 8
B) 5
C)9
D)4
ANSWER: D
1. #include <stdio.h>
4. int main()
5. {
7. int k;
8. k = m;
9. printf("%d\n", k);
10. return 0;
11. }
A) 0
C)1
D)8
ANSWER: D
1. #include <stdio.h>
3. {
4. printf("Sanfoundry.com");
5. return 0;
6. }
7. void main()
8. {
9. print();
10. }
B) Sanfoundry.com
ANSWER: B
2. int main()
3. {
5. return 0;
6. }
A) Yes
B) No
D)Error
ANSWER: C
1. #include <stdio.h>
2. void main()
3. {
4. int x = 5 * 9 / 3 + 9;
5. }
A) 3.75
B) Depends on compiler
C)24
D)3
ANSWER: C
42. What will be the output of the following C code? (Initial values: x= 7, y = 8)
1. #include <stdio.h>
2. void main()
3. {
4. float x;
5. int y;
9. }
A) 7.000000, 7
C)7.000000, junk
D)Varies
ANSWER: C
43. What will be the output of the following C code considering the size of a short int is 2, char
is 1 and int is 4 bytes?
1. #include <stdio.h>
2. int main()
3. {
5. char c = 97;
7. return 0;
8. }
A) 2, 1, 2
B) 2, 1, 1
C)2, 1, 4
D)2, 2, 8
ANSWER: C
2. int main()
3. {
4. int d, a = 1, b = 2;
5. d = a++ + ++b;
7. }
2. int main()
3. {
4. int d, a = 1, b = 2;
5. d = a++ +++b;
7. }
A) No difference as space doesn’t make any difference, values of a, b, d are same in both the
case
ANSWER: D
45. What will be the output of the following C code snippet?
1. #include <stdio.h>
2. void main()
3. {
5. }
A) returns 1
B) returns 2
C)Varies
ANSWER: D
A) 2
B) True
C)1
D)0
ANSWER: A
1. #include <stdio.h>
3. int main()
4. {
5. reverse(1);
6. }
7. void reverse(int i)
8. {
9. if (i > 5)
10. return ;
13. }
A) 1 2 3 4 5
B) Segmentation fault
C)Compilation error
D)Undefined behaviour
ANSWER: A
48. What will be the final values of i and j in the following C code?
1. #include <stdio.h>
2. int x = 0;
3. int f()
4. {
5. if (x == 0)
6. return x + 1;
7. else
8. return x - 1;
9. }
11. {
13. }
15. {
18. }
ANSWER: C
n = 1;
A) Output will be 3, 2
B) Output will be 3, 1
C)Output will be 6, 1
ANSWER: D
50. How many times i value is checked in the following C program?
1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5. while (i < 3)
6. i++;
8. }
A) 2
B) 3
C)4
D)1
ANSWER: C
1. #include <stdio.h>
2. int main()
3. {
4. int i = 0;
5. do
6. {
7. i++;
8. if (i == 2)
9. continue;
10. printf("In while loop ");
13. }
A) In while loop 2
D)Infinite loop
ANSWER: A
52. What will be the data type returned for the following C function?
1. #include <stdio.h>
2. int func()
3. {
4. return (double)(char)5.0;
5. }
A) char
B) int
C)double
ANSWER: B
int func(int);
double func(int);
int func(float);
C)A function with same name cannot have different number of parameters
ANSWER: D
string p = "HELLO";
ANSWER: B
printf(“%10s”, state);
ANSWER: B
56. What are the elements present in the array of the following C code?
B) 5, 0, 0, 0, 0
ANSWER: B
57. What will be the output of the following C function when EOF returns?
ANSWER: D
58. Which part of the program address space is p stored in the following C code?
1. #include <stdio.h>
2. int *p;
3. int main()
4. {
5. int i = 0;
6. p = &i;
7. return 0;
8. }
A) Code/text segment
B) Data segment
C)Bss segment
D)Stack
ANSWER: C
A)
#if
#else
#endif
B)
#if
#elif
#endif
c)
#if
#if
#endif
d)
#if
#undef
#endif
ANSWER: C
1. #include <stdio.h>
2. main()
3. {
4. char *p = 0;
5. *p = 'a';
7. }
A) It will print a
B) It will print 0
ANSWER:D
1. #include <stdio.h>
2. main()
3. {
5. printf("True");
6. else
7. printf("False");
8. }
A) True
B) False
ANSWER:B
61. What is the output of this C code?
1. #include <stdio.h>
2. main()
3. {
5. p[0] = 'a';
6. p[1] = 'b';
7. printf("%s", p);
8. }
A) abnfoundry C-Test
B) Sanfoundry C-Test
ANSWER:D
1. #include <stdio.h>
2. int main()
3. {
4. float f = 0.1;
5. if (f == 0.1)
6. printf("True");
7. else
8. printf("False");
9. }
A) True
B) False
ANSWER: B
1. #include <stdio.h>
2. main()
3. {
4. int n = 0, m = 0;
5. if (n > 0)
6. if (m > 0)
7. printf("True");
8. else
9. printf("False");
10. }
A) True
B) False
ANSWER:C
A) A programming language
B) A collection of algorithms
ANSWER: C
Explanation: A data structure is a way to store and organize data efficiently, enhancing access
and manipulation, unlike programming languages, algorithms, or computer hardware.
D) There are chances of wastage of memory space if elements inserted in an array are
lesser than the allocated size
ANSWER: D
Explanation: Arrays are of fixed size. If we insert elements less than the allocated size,
unoccupied positions can’t be used again. Wastage will occur in memory.
A) Stack
B) Queue
C) List
D) Array
ANSWER: A
B) Stack
C) Tree
D) Array
ANSWER: B
Explanation: The stack is a simple data structure in which elements are added and removed
based on the LIFO principle. Open parenthesis is pushed into the stack and a closed
parenthesis pops out elements till the top element of the stack is its corresponding open
parenthesis. If the stack is empty, parenthesis is balanced otherwise it is unbalanced.
ANSWER: A
Explanation: Data transfer between the two asynchronous process uses the queue data
structure for synchronisation. The rest are all stack applications.
A) Tree
B) Branch
C) Stack
D) Queue
ANSWER: C
Explanation: The Stack data structure is used to convert infix expression to postfix
expression. The purpose of stack is to reverse the order of the operators in the expression. It
also serves as a storage structure, as no operator can be printed until both of its operands
have appeared.
A) 74
B) -18
C) 22
D) 40
ANSWER: B
8. What data structure would you mostly likely see in non recursive implementation of a
recursive algorithm?
A) Stack
B) Linked List
C) Tree
D) Queue
ANSWER: A
Explanation: In recursive algorithms, the order in which the recursive process comes back is
the reverse of the order in which it goes forward during execution. The compiler uses the
stack data structure to implement recursion. In the forwarding phase, the values of local
variables, parameters and the return address are pushed into the stack at each recursion
level. In the backing-out phase, the stacked address is popped and used to execute the rest
of the code.
9. Which of the following statement(s) about stack data structure is/are NOT correct?
ANSWER: B
10. The data structure required for Breadth First Traversal on a graph is?
A) Array
B) Stack
C) Tree
D) Queue
ANSWER: D
Explanation: In Breadth First Search Traversal, BFS, starting vertex is first taken and adjacent
vertices which are unvisited are also taken. Again, the first vertex which was added as an
unvisited adjacent vertex list will be considered to add further unvisited vertices of the graph.
To get the first unvisited vertex we need to follows First In First Out principle. Queue uses
FIFO principle.
A) -A/B*C^DE
B) -A/BC*^DE
C) -ABCD*^DE
D) -/*^ACBDE
ANSWER: A
(-A/B)(C*D^E)
B) Access of elements in linked list takes less time than compared to arrays
C) Arrays have better cache locality that can make them better in terms of performance
ANSWER: B
Explanation: To access an element in a linked list, we need to traverse every element until we
reach the desired element. This will take more time than arrays as arrays provide random
access to its elements.
13. Which data structure is based on the Last In First Out (LIFO) principle?
A) Tree
B) Linked List
C) Stack
D) Queue
ANSWER: C
Explanation: The data structure that follows the Last In First Out (LIFO) principle is the Stack.
It operates like a stack of objects, making it suitable for specific-order management.
14. Which of the following application makes use of a circular linked list?
ANSWER: D
Explanation: Generally, round robin fashion is employed to allocate CPU time to resources
which makes use of the circular linked list data structure. Recursive function calls use stack
data structure. Undo Operation in text editor uses doubly linked lists. Hash tables uses singly
linked lists.
ANSWER: A
16. Which of the following tree data structures is not a balanced binary tree?
A) Splay tree
B) B-tree
C) AVL tree
D) Red-black tree
ANSWER: B
Explanation: All the tree data structures given in options are balanced, but B-tree can have
more than two children.
A) Priority queue
B) Circular queue
D) Ordinary queue
ANSWER: C
Explanation: Queue always has two ends. So, single ended queue is not the type of queue.
18. Which of the following data structures can be used for parentheses matching?
A) n-ary tree
B) queue
C) priority queue
D) stack
ANSWER: D
Explanation: For every opening brace, push it into the stack, and for every closing brace, pop
it off the stack. Do not take action for any other character. In the end, if the stack is empty,
then the input has balanced parentheses.
A) Backtracking
C) Branch
D) Greedy
ANSWER: B
Explanation: Top tree is a type of data structure which is based on unrooted dynamic binary
tree and is used to solve path related problems. It allows an algorithm called divide and
conquer.
A) easier computations
ANSWER: C
Explanation: In a linear queue, dequeue operation causes the starting elements of the array to
be empty, and there is no way you can use that space, while in a circular queue, you can
effectively use that space. Priority queue is used to delete the elements based on their priority.
Higher priority elements will be deleted first whereas lower priority elements will be deleted
next. Queue data structure always follows FIFO principle.
21. Which of the following is the most widely used external memory data structure?
A) B-tree
B) Red-black tree
C) AVL tree
ANSWER: A
Explanation: In external memory, the data is transferred in form of blocks. These blocks have
data valued and pointers. And B-tree can hold both the data values and pointers. So B-tree is
used as an external memory data structure.
A) Linked List
B) Array
C) String
D) Cord
ANSWER: D
Explanation: Array is a linear data structure. Strings are a collection and sequence of codes,
alphabets or characters. Linked List is a linear data structure having a node containing data
input and the address of the next node. The cord is also known as the rope data structure.
int i;
for(i=0;i<len;i++)
for(i=0;i<len;i++)
A) yrdnuof nas
B) foundry nas
C) sanfoundry
D) san foundry
ANSWER: A
Explanation: First, the string ‘san foundry’ is pushed one by one into the stack.
24. Which of the following data structure can provide efficient searching of the elements?
B) unordered lists
C) 2-3 tree
D) treap
ANSWER: C
Explanation: The average case time for lookup in a binary search tree, treap and 2-3 tree is
O(log n) and in unordered lists it is O(n). But in the worst case, only the 2-3 trees perform
lookup efficiently as it takes O(log n), while others take O(n).
ANSWER: B
26. What is the time complexity for searching a key or integer in Van Emde Boas data
structure?
A) O (M!)
B) O (log M!)
D) O (M2)
ANSWER: C
Explanation: In order to search a key or integer in the Van Emde Boas data structure, the
operation can be performed on an associative array. Hence, the time complexity for searching
a key or integer in Van Emde Boas data structure is O (log (log M)).
27. The optimal data structure used to solve Tower of Hanoi is _________
A) Tree
B) Heap
C) Priority queue
D) Stack
ANSWER: D
Explanation: The Tower of Hanoi involves moving of disks ‘stacked’ at one peg to another peg
with respect to the size constraint. It is conveniently done using stacks and priority queues.
Stack approach is widely used to solve Tower of Hanoi.
ANSWER: B
Explanation: Bin data structure allows us to have efficient region queries. A frequency of bin is
increased by one each time a data point falls into a bin.
29. Which is the most appropriate data structure for reversing a word?
A) stack
B) queue
C) graph
D) tree
ANSWER: A
Explanation: Stack is the most appropriate data structure for reversing a word because stack
follows LIFO principle.
if(size == 0)
System.out.println("underflow");
else
while(current != null)
System.out.println(current.getEle());
current = current.getNext();
ANSWER: A
Explanation: An alias of the node ‘first’ is created which traverses through the list and displays
the elements.
31. Which of the following is the simplest data structure that supports range searching?
A) AA-trees
B) K-d trees
C) Heaps
Explanation: K-d trees are the simplest data structure that supports range searching and also
it achieves the respectable running time.
A) easy to implement
ANSWER: B
Explanation: Hash table is a data structure that has an advantage that it allows fast access of
elements. Hash functions are used to determine the index of any input record in a hash table.
A) Hash
B) Array
C) Priority Stack
D) Priority Queue
ANSWER: D
Explanation: Ternary heap is a type of data structure in the field of computer science. It is a
part of the Heap data structure family. It is a priority queue type of data structure that follows
all the property of heap.
C) A queue with insert/delete defined for both front and rear ends of the queue
D) A queue implemented with a doubly linked list
ANSWER: C
Explanation: A dequeue or a double ended queue is a queue with insert/delete defined for
both front and rear ends of the queue.
35. A data structure in which elements can be inserted or deleted at/from both ends but not in
the middle is?
A) Priority queue
B) Dequeue
C) Circular queue
D) Queue
ANSWER: B
Explanation: In dequeuer, we can insert or delete elements from both the ends. In queue, we
will follow first in first out principle for insertion and deletion of elements. Element with least
priority will be deleted in a priority queue.
System.out.println(arr[2]);
System.out.println(arr[4]);
A) 4 and 2
B) 2 and 4
C) 5 and 3
D) 3 and 5
ANSWER: D
D) Binary trees
ANSWER: A
Explanation: Deletion becomes easier with doubly linked list, hence it is appropriate.
A) A programming language
B) A collection of algorithms
ANSWER: C
Explanation: A data structure is a way to store and organize data efficiently, enhancing access
and manipulation, unlike programming languages, algorithms, or computer hardware.
D) There are chances of wastage of memory space if elements inserted in an array are
lesser than the allocated size
ANSWER: D
Explanation: Arrays are of fixed size. If we insert elements less than the allocated size,
unoccupied positions can’t be used again. Wastage will occur in memory.
A) Stack
B) Queue
C) List
D) Array
ANSWER: A
A) Queue
B) Stack
C) Tree
D) Array
ANSWER: B
Explanation: The stack is a simple data structure in which elements are added and removed
based on the LIFO principle. Open parenthesis is pushed into the stack and a closed
parenthesis pops out elements till the top element of the stack is its corresponding open
parenthesis. If the stack is empty, parenthesis is balanced otherwise it is unbalanced.
ANSWER: A
Explanation: Data transfer between the two asynchronous process uses the queue data
structure for synchronisation. The rest are all stack applications.
A) Tree
B) Branch
C) Stack
D) Queue
ANSWER: C
Explanation: The Stack data structure is used to convert infix expression to postfix
expression. The purpose of stack is to reverse the order of the operators in the expression. It
also serves as a storage structure, as no operator can be printed until both of its operands
have appeared.
A) 74
B) -18
C) 22
D) 40
ANSWER: B
A) Stack
B) Linked List
C) Tree
D) Queue
ANSWER: A
Explanation: In recursive algorithms, the order in which the recursive process comes back is
the reverse of the order in which it goes forward during execution. The compiler uses the
stack data structure to implement recursion. In the forwarding phase, the values of local
variables, parameters and the return address are pushed into the stack at each recursion
level. In the backing-out phase, the stacked address is popped and used to execute the rest
of the code.
9. Which of the following statement(s) about stack data structure is/are NOT correct?
C) Null link is present in the last node at the bottom of the stack
ANSWER: B
10. The data structure required for Breadth First Traversal on a graph is?
A) Array
B) Stack
C) Tree
D) Queue
ANSWER: D
Explanation: In Breadth First Search Traversal, BFS, starting vertex is first taken and adjacent
vertices which are unvisited are also taken. Again, the first vertex which was added as an
unvisited adjacent vertex list will be considered to add further unvisited vertices of the graph.
To get the first unvisited vertex we need to follows First In First Out principle. Queue uses
FIFO principle.
A) -A/B*C^DE
B) -A/BC*^DE
C) -ABCD*^DE
D) -/*^ACBDE
ANSWER: A
(-A/B)(C*D^E)
12. Which of the following points is/are not true about Linked List data structure when it is
compared with an array?
B) Access of elements in linked list takes less time than compared to arrays
C) Arrays have better cache locality that can make them better in terms of performance
ANSWER: B
Explanation: To access an element in a linked list, we need to traverse every element until we
reach the desired element. This will take more time than arrays as arrays provide random
access to its elements.
13. Which data structure is based on the Last In First Out (LIFO) principle?
A) Tree
B) Linked List
C) Stack
D) Queue
ANSWER: C
Explanation: The data structure that follows the Last In First Out (LIFO) principle is the Stack.
It operates like a stack of objects, making it suitable for specific-order management.
14. Which of the following application makes use of a circular linked list?
ANSWER: D
Explanation: Generally, round robin fashion is employed to allocate CPU time to resources
which makes use of the circular linked list data structure. Recursive function calls use stack
data structure. Undo Operation in text editor uses doubly linked lists. Hash tables uses singly
linked lists.
ANSWER: A
A) Splay tree
B) B-tree
C) AVL tree
D) Red-black tree
ANSWER: B
Explanation: All the tree data structures given in options are balanced, but B-tree can have
more than two children.
A) Priority queue
B) Circular queue
D) Ordinary queue
ANSWER: C
Explanation: Queue always has two ends. So, single ended queue is not the type of queue.
18. Which of the following data structures can be used for parentheses matching?
A) n-ary tree
B) queue
C) priority queue
D) stack
ANSWER: D
Explanation: For every opening brace, push it into the stack, and for every closing brace, pop
it off the stack. Do not take action for any other character. In the end, if the stack is empty,
then the input has balanced parentheses.
19. Which algorithm is used in the top tree data structure?
A) Backtracking
C) Branch
D) Greedy
ANSWER: B
Explanation: Top tree is a type of data structure which is based on unrooted dynamic binary
tree and is used to solve path related problems. It allows an algorithm called divide and
conquer.
A) easier computations
ANSWER: C
Explanation: In a linear queue, dequeue operation causes the starting elements of the array to
be empty, and there is no way you can use that space, while in a circular queue, you can
effectively use that space. Priority queue is used to delete the elements based on their priority.
Higher priority elements will be deleted first whereas lower priority elements will be deleted
next. Queue data structure always follows FIFO principle.
21. Which of the following is the most widely used external memory data structure?
A) B-tree
B) Red-black tree
C) AVL tree
ANSWER: A
Explanation: In external memory, the data is transferred in form of blocks. These blocks have
data valued and pointers. And B-tree can hold both the data values and pointers. So B-tree is
used as an external memory data structure.
A) Linked List
B) Array
C) String
D) Cord
ANSWER: D
Explanation: Array is a linear data structure. Strings are a collection and sequence of codes,
alphabets or characters. Linked List is a linear data structure having a node containing data
input and the address of the next node. The cord is also known as the rope data structure.
main()
int i;
for(i=0;i<len;i++)
for(i=0;i<len;i++)
}
A) yrdnuof nas
B) foundry nas
C) sanfoundry
D) san foundry
ANSWER: A
Explanation: First, the string ‘san foundry’ is pushed one by one into the stack.
24. Which of the following data structure can provide efficient searching of the elements?
B) unordered lists
C) 2-3 tree
D) treap
ANSWER: C
Explanation: The average case time for lookup in a binary search tree, treap and 2-3 tree is
O(log n) and in unordered lists it is O(n). But in the worst case, only the 2-3 trees perform
lookup efficiently as it takes O(log n), while others take O(n).
ANSWER: B
A) O (M!)
B) O (log M!)
D) O (M2)
ANSWER: C
Explanation: In order to search a key or integer in the Van Emde Boas data structure, the
operation can be performed on an associative array. Hence, the time complexity for searching
a key or integer in Van Emde Boas data structure is O (log (log M)).
27. The optimal data structure used to solve Tower of Hanoi is _________
A) Tree
B) Heap
C) Priority queue
D) Stack
ANSWER: D
Explanation: The Tower of Hanoi involves moving of disks ‘stacked’ at one peg to another peg
with respect to the size constraint. It is conveniently done using stacks and priority queues.
Stack approach is widely used to solve Tower of Hanoi.
ANSWER: B
Explanation: Bin data structure allows us to have efficient region queries. A frequency of bin is
increased by one each time a data point falls into a bin.
29. Which is the most appropriate data structure for reversing a word?
A) stack
B) queue
C) graph
D) tree
ANSWER: A
Explanation: Stack is the most appropriate data structure for reversing a word because stack
follows LIFO principle.
if(size == 0)
System.out.println("underflow");
else
while(current != null)
System.out.println(current.getEle());
current = current.getNext();
}
}
ANSWER: A
Explanation: An alias of the node ‘first’ is created which traverses through the list and displays
the elements.
31. Which of the following is the simplest data structure that supports range searching?
A) AA-trees
B) K-d trees
C) Heaps
ANSWER: C
Explanation: K-d trees are the simplest data structure that supports range searching and also
it achieves the respectable running time.
A) easy to implement
ANSWER: B
Explanation: Hash table is a data structure that has an advantage that it allows fast access of
elements. Hash functions are used to determine the index of any input record in a hash table.
33. Which type of data structure is a ternary heap?
A) Hash
B) Array
C) Priority Stack
D) Priority Queue
ANSWER: D
Explanation: Ternary heap is a type of data structure in the field of computer science. It is a
part of the Heap data structure family. It is a priority queue type of data structure that follows
all the property of heap.
C) A queue with insert/delete defined for both front and rear ends of the queue
ANSWER: C
Explanation: A dequeue or a double ended queue is a queue with insert/delete defined for
both front and rear ends of the queue.
35. A data structure in which elements can be inserted or deleted at/from both ends but not in
the middle is?
A) Priority queue
B) Dequeue
C) Circular queue
D) Queue
ANSWER: B
Explanation: In dequeuer, we can insert or delete elements from both the ends. In queue, we
will follow first in first out principle for insertion and deletion of elements. Element with least
priority will be deleted in a priority queue.
System.out.println(arr[2]);
System.out.println(arr[4]);
A) 4 and 2
B) 2 and 4
C) 5 and 3
D) 3 and 5
ANSWER: D
D) Binary trees
ANSWER: A
Explanation: Deletion becomes easier with doubly linked list, hence it is appropriate.
A) A programming language
B) A collection of algorithms
ANSWER: C
Explanation: A data structure is a way to store and organize data efficiently, enhancing access
and manipulation, unlike programming languages, algorithms, or computer hardware.
A) Array
B) Stack
C) Queue
D) Loop
ANSWER: D
Explanation: Arrays, stacks, and queues are common types of data structures, but a loop is a
control flow construct used in programming.
What is a stack?
A) A linear data structure with FIFO (First In, First Out) access
B) A linear data structure with LIFO (Last In, First Out) access
Explanation: A stack is a linear data structure where elements are added and removed from
the same end, called the top, using Last In, First Out (LIFO) access.
Which data structure allows access to elements in a fixed sequence and supports random
access?
A) Array
B) Linked List
C) Stack
D) Queue
ANSWER: A
Explanation: Arrays allow access to elements in a fixed sequence and support random access
to any element by index.
C) A collection of nodes where each node points to the next node in the sequence
ANSWER: C
Explanation: A linked list is a linear data structure where elements are stored in nodes, and
each node points to the next node in the sequence.
ANSWER: B
Explanation: A queue follows First In, First Out (FIFO) access, where elements are added at
the rear and removed from the front.
C) A collection of algorithms
ANSWER: B
A) 1
B) 2
C) 3
D) 4
ANSWER: B
Explanation: In a binary tree, each node has at most two children, referred to as the left child
and the right child.
Which of the following traversal methods visits the root node first, followed by the left subtree
and then the right subtree?
A) Preorder traversal
B) Inorder traversal
C) Postorder traversal
ANSWER: A
Explanation: Preorder traversal visits the root node first, followed by the left subtree and then
the right subtree.
C) A collection of algorithms
ANSWER: B
Explanation: A graph is a non-linear data structure consisting of nodes (vertices) and edges
(connections between vertices).
ANSWER: A
Explanation: In a directed graph, each edge has a direction indicating the flow from one node
to another.
ANSWER: A
Explanation: A spanning tree of a graph is a tree that contains all the nodes of the graph with
the minimum possible number of edges.
Which of the following algorithms is used to find the shortest path in a weighted graph?
C) Dijkstra's algorithm
D) Prim's algorithm
ANSWER: C
Explanation: Dijkstra's algorithm is used to find the shortest path in a weighted graph with
non-negative edge weights.
A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
ANSWER: B
Explanation: The binary search algorithm has a time complexity of O(log n), where n is the
number of elements in the sorted array.
A) Bubble Sort
B) Merge Sort
C) Insertion Sort
D) Selection Sort
ANSWER: B
Explanation: Merge Sort has the best average-case time complexity of O(n log n) among the
given sorting algorithms.
C) A method for solving complex problems by breaking them down into simpler subproblems
ANSWER: C
A) Optimal Substructure
B) Overlapping Subproblems
ANSWER: C
A) An algorithm that makes locally optimal choices at each step with the hope of finding a
global optimum
B) An algorithm that exhaustively searches all possible solutions
C) An algorithm that divides the problem into smaller subproblems and solves each
subproblem optimally
ANSWER: A
Explanation: A greedy algorithm makes locally optimal choices at each step with the hope of
finding a global optimum solution.
What is an algorithm?
C) A programming language
ANSWER: A
B) An algorithm for searching through a sorted array by repeatedly dividing the search interval
in half
ANSWER: B
Explanation: A binary search algorithm is a technique for finding a particular value within a
sorted array by repeatedly dividing the search interval in half. This approach significantly
reduces the number of comparisons needed to locate the target element, making it more
efficient than linear search algorithms.
What is the time complexity of the bubble sort algorithm for an array of length n?
A) O(n)
B) O(n log n)
C) O(n^2)
D) O(log n)
ANSWER: C
Explanation: The bubble sort algorithm has a time complexity of O(n^2) in the worst and
average case scenarios. This means that the number of comparisons and swaps grows
quadratically with the size of the input array, making it less efficient compared to other sorting
algorithms such as quicksort or mergesort.
A) Array
B) Linked list
C) Stack
D) Tree
ANSWER: B
Explanation: A linked list is commonly used to implement a queue data structure due to its
dynamic memory allocation and efficient insertion and deletion operations at both ends. In a
linked list-based queue, elements are added at one end (rear) and removed from the other
end (front), following the First-In-First-Out (FIFO) principle.
B) An algorithm that searches through a sorted array by comparing the target value with the
middle element
C) An algorithm that sequentially checks each element in a collection until a match is found or
the end of the collection is reached
ANSWER: C
Explanation: The linear search algorithm, also known as sequential search, involves
sequentially checking each element in a collection until a match is found or the end of the
collection is reached. It is a simple and straightforward searching technique applicable to both
sorted and unsorted data.
A) O(n)
B) O(log n)
C) O(n^2)
D) O(1)
ANSWER: A
Explanation: The time complexity of linear search in the worst-case scenario is O(n), where n
is the number of elements in the collection being searched. This is because in the worst-case
scenario, the algorithm may need to examine each element in the collection sequentially until
it finds the target element or reaches the end of the collection.
Which searching algorithm is particularly efficient for large sorted arrays?
A) Linear search
B) Binary search
C) Depth-first search
D) Breadth-first search
ANSWER: B
Explanation: Binary search is particularly efficient for large sorted arrays because it operates
by repeatedly dividing the search interval in half, significantly reducing the number of
comparisons needed to locate the target element. It has a time complexity of O(log n) in the
worst-case scenario, making it highly efficient for large datasets compared to linear search.
D) A process for solving problems related to graphs, such as finding paths or cycles
ANSWER: D
A) An algorithm for finding the shortest path between two nodes in a weighted graph
Explanation: Dijkstra's algorithm is a popular graph algorithm used to find the shortest path
between two nodes in a weighted graph. It operates by iteratively exploring nodes in the
graph based on their distance from the starting node, updating the shortest distances and
paths as it progresses. Dijkstra's algorithm is commonly employed in applications such as
routing protocols, network analysis, and transportation planning.
A) O(V)
B) O(E)
C) O(V + E)
D) O(V^2)
ANSWER: C
Explanation: The time complexity of Dijkstra's algorithm is O(V + E), where V is the number of
vertices (nodes) and E is the number of edges in the graph. This complexity arises from the
fact that the algorithm must visit each vertex and process each edge exactly once during its
execution, leading to a linear time complexity in terms of both vertices and edges.
Which graph algorithm is commonly used to find the minimum spanning tree of a graph?
A) Dijkstra's algorithm
D) Prim's algorithm
ANSWER: D
Explanation: Prim's algorithm is commonly used to find the minimum spanning tree (MST) of a
graph. The MST is a subset of the edges of the original graph that forms a tree and includes
all the vertices of the original graph with the minimum possible total edge weight. Prim's
algorithm greedily selects edges with the smallest weight to construct the minimum spanning
tree efficiently.
What is a tree data structure?
C) A hierarchical data structure consisting of nodes connected by edges, with a single root
node at the top
ANSWER: C
B) A tree structure where each node has more than two children
C) A tree structure where each node has at most two children, and the left child is less than
the parent, while the right child is greater
ANSWER: C
Explanation: A binary search tree (BST) is a type of binary tree where each node has at most
two children: a left child and a right child. In a BST, the value of the left child is less than the
value of its parent node, and the value of the right child is greater than the parent node. This
property allows for efficient searching, insertion, and deletion operations.
Which traversal algorithm visits the nodes of a binary tree in the order: left subtree, root, right
subtree?
A) Inorder traversal
B) Preorder traversal
C) Postorder traversal
D) Level order traversal
ANSWER: A
Explanation: Inorder traversal visits the nodes of a binary tree in the order of left subtree, root,
and right subtree. This traversal strategy is commonly used to retrieve elements from a binary
search tree in sorted order.
What is the time complexity of searching in a balanced binary search tree (BST) with n
nodes?
A) O(log n)
B) O(n)
C) O(n log n)
D) O(1)
ANSWER: A
Explanation: The time complexity of searching in a balanced binary search tree (BST) with n
nodes is O(log n). This is because a balanced BST ensures that the height of the tree remains
logarithmic with respect to the number of nodes, resulting in efficient search operations
comparable to binary search on sorted arrays.
ANSWER: B
A) Bubble sort
B) Depth-first search
C) Binary search
ANSWER: D
Explanation: The Knuth-Morris-Pratt (KMP) algorithm is commonly used for pattern matching
within a text. It efficiently finds occurrences of a given pattern within a larger text by utilizing
the concept of prefix functions to avoid unnecessary comparisons.
A) O(n log n)
B) O(n^2)
C) O(log n)
D) O(n)
ANSWER: B
Explanation: The naive string matching algorithm compares each character of the pattern with
each character of the text, resulting in a time complexity of O(n^2), where n is the length of
the text. This algorithm is straightforward but may become inefficient for large texts or
patterns.
Which string algorithm is used for efficiently finding the longest common subsequence
between two strings?
A) Rabin-Karp algorithm
B) Boyer-Moore algorithm
D) Aho-Corasick algorithm
ANSWER: C
Explanation: The Longest Common Subsequence (LCS) algorithm is used for efficiently
finding the longest common subsequence between two strings. It employs dynamic
programming to identify the longest sequence of characters that appears in the same order in
both strings, allowing for various applications such as sequence alignment and similarity
measurement.