Computer Science Questions
Explore questions in the Computer Science category that you can ask Spark.E!
What is Kruskal's Algorithm used for in a graph?A. To find Minimum spanning treeB. To find a circleC. To traverse a graphD. To find a path
What is the output of the following list assignment?aList = [4, 8, 12, 16]aList[1:4] = [20, 24, 28]print(aList)A. [4, 20, 24, 28, 8, 12, 16]B. [4, 20, 24, 28]C. [4, 8, 12, 16]D. [20, 24, 28]
In hashing, what is direct addressing?A. Distinct array position for every possible keyB. Fewer array positions than keysC. Fewer keys than array positionsD. Same array position for all keys
Consider the following operation performed on a stack of size 5:Push(1);Push(2);Push(3);Pop();Push(4);Pop();Pop();Push(5);After the completion of all operations, the number of elements present on the stack are:A. 1B. 2C. 3D. 4
With polymorphism and dynamic binding, an object can:(a) Invoke operation of different names on the same objects.(b) Invoke operations of different names on different objects.(c) Invoke an operation of the same name on the same object.(d) Invoke an operation of the same name on different objects.
A pointer variable which contains the location at the top element of the stack is called:A. topB. lastC. tailD. end
Consider a 10-element hash table for which f(key)=key mod 10 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 12 be inserted, if the keys 2, 10, 11 and 12 are inserted in that order?A. 2B. 3C. 4D. 5
A graph in which exists a path between any two nodes is called:A. Complete graphB. Connected graphC. DigraphD. In-directed graph
What is the output of the following program?a = [5, 3, 8, 7, 1]print(a.index(2))A. 0B. nullC. 8D. Error
Prefix notation is also known as:A. Reverse Polish NotationB. Reverse NotationC. Polish NotationD. Polish Reverse Notation
Which of the following objects should be assigned to the same subsystem?Đối tượng nào sau đây nên được gán cho cùng một hệ thống con?(a) Objects that are part of the same composite objectCác đối tượng là một phần của cùng một đối tượng tổng hợp(b) Client and server objects(c) User interface and entity objects(d) Objects that are associated with each other
What is the minimum spanning tree (MST)?A. Spanning subgraphB. Spanning treeC. Spanning tree of a weighted graph with minimum total edge weightD. Shortest path
What is a software architectural pattern?(a) The structure of the major subsystems of a system(b) The components and connectors in a software architecture(c) A small group of collaborating objects(d) A recurring architecture used in a variety of systems
Which of the following is not a collision resolution technique?A. Separate chainingB. Linear probingC. Quadratic probingD. Hashing
In recursive programs, what happens if the base condition is not defined?A. It runs into infinite loopB. Exception is thrownC. No problemD. None of these
What is a disadvantage of recursion?A. Recursive calls are expensive (inefficient) as they take up a lot of memory and timeB. Sequence generation is more difficult with recursion than using some nested iterationC. A complex task can not be broken down into simpler sub-problems using recursionD. None of these
Given a hash table with size 100 and Division hashing method is used, in what location will the key 123 be hashed?A. 0B. 22C. 23D. 24
The number of elements in the weighted matrix of a graph having 5 vertices is?A. 5B. 16C. 25D. 36
What does the following algorithm do?def depth(self, p): if self.is_root(p): return 0 else: return 1 + self.depth(self.parent(p))A. Computing the depth of a position p in treeB. Computing the number of children of a position p in treeC. Computing the leaf nodes of treeD. Computing the degree of a position p in tree
What will be the output of the following code?def func(n): if (n > 0): func(int(n / 2)) print(n % 2)func(11)A. 11B. 1011C. 1101D. 0
