0% found this document useful (0 votes)
17 views6 pages

Answer of Questions

The document contains a series of reasoning, data structure, algorithm, Java, HTML, and CSS questions along with their respective answers. Each question is presented in a multiple-choice format, covering various topics such as time complexity, programming concepts, and web development. The answers are provided alongside explanations for clarity.

Uploaded by

Abhineet chaubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Answer of Questions

The document contains a series of reasoning, data structure, algorithm, Java, HTML, and CSS questions along with their respective answers. Each question is presented in a multiple-choice format, covering various topics such as time complexity, programming concepts, and web development. The answers are provided alongside explanations for clarity.

Uploaded by

Abhineet chaubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Reasoning Questions

1. What is the missing number in the series: 2, 6, 12, 20, 30, ?


 A) 40
 B) 42
 C) 44
 D) 46
 Answer: C) 44 (Pattern: n2+n)
2. In a class of 50 students, 30 play football and 20 play basketball. If 10 play both, how
many students do not play any game?
 A) 10
 B) 20
 C) 15
 D) 5
 Answer: B) 20 (Venn Diagram: 50−(30+20−10)=10)
3. If all roses are flowers and some flowers fade quickly, which statement is true?
 A) All flowers are roses.
 B) Some roses may fade quickly.
 C) No roses fade quickly.
 D) All flowers fade quickly.
 Answer: B) Some roses may fade quickly.
4. If A is the brother of B, B is the sister of C, and C is the mother of D, how is A related to
D?
 A) Uncle
 B) Father
 C) Brother
 D) Grandfather
 Answer: A) Uncle
5. A clock shows 10 minutes past 4. What is the angle between the hour and minute
hands?
 A) 60°
 B) 75°
 C) 70°
 D) 50°
 Answer: C) 70° (Calculation: ∣ 30H−5.5M∣ )

Data Structure & Algorithm Questions


6. What is the time complexity of the binary search algorithm?
 A) O(n)
 B) O(log n)
 C) O(n log n)
 D) O(n^2)
 Answer: B) O(log n)
7. Which data structure is used in the implementation of recursion?
 A) Queue
 B) Stack
 C) Linked List
 D) Tree
 Answer: B) Stack
8. What is the time complexity of adding an element at the end of an ArrayList in Java,
on average?
 A) O(1)
 B) O(n)
 C) O(log n)
 D) O(n^2)
 Answer: A) O(1)
9. Which sorting algorithm has the best average-case time complexity?
 A) Quick Sort
 B) Merge Sort
 C) Bubble Sort
 D) Selection Sort
 Answer: B) Merge Sort (O(n log n))
10. What is the primary advantage of using a linked list over an array?
 A) Faster access to elements
 B) More efficient memory usage
 C) Easier to sort
 D) Fixed size
 Answer: B) More efficient memory usage
11. In a max-heap, which of the following holds true?
 A) Every child node has a value greater than or equal to its parent.
 B) Every parent node has a value greater than or equal to its child nodes.
 C) It is always a complete binary tree.
 D) All leaf nodes have the same depth.
 Answer: B) Every parent node has a value greater than or equal to its child
nodes.
12. Which graph traversal algorithm uses a queue data structure?
 A) Depth-First Search
 B) Breadth-First Search
 C) Dijkstra’s Algorithm
 D) Kruskal’s Algorithm
 Answer: B) Breadth-First Search
13. What is the time complexity of finding the maximum element in an unsorted
array?
 A) O(1)
 B) O(n)
 C) O(log n)
 D) O(n log n)
 Answer: B) O(n)
14. Which of the following is not a self-balancing binary search tree?
 A) AVL Tree
 B) Red-Black Tree
 C) B-Tree
 D) Binary Search Tree (BST)
 Answer: D) Binary Search Tree (BST)
15. In a circular queue, how do you calculate the position of the next element to be
dequeued?
 A) (front + 1) % capacity
 B) (rear + 1) % capacity
 C) (rear - 1) % capacity
 D) (front - 1) % capacity
 Answer: A) (front + 1) % capacity

Java Questions
16. Which of the following is a valid declaration of a char in Java?
 A) char c = '\u0061';
 B) char c = 'ab';
 C) char c = "a";
 D) char c = 65;
 Answer: A) char c = '\u0061';
17. What is the output of the following Java code?
java
Copy code
int a = 10;
int b = 20;
System.out.println(a++ + ++b);

 A) 30
 B) 31
 C) 32
 D) 33
 Answer: C) 32
18. Which of the following is not a feature of Java?
 A) Platform-independent
 B) Object-oriented
 C) Procedural
 D) Dynamic
 Answer: C) Procedural
19. Which method must be implemented by all threads in Java?
 A) start()
 B) stop()
 C) run()
 D) execute()
 Answer: C) run()
20. What is the default value of an uninitialized boolean variable in Java?
 A) true
 B) false
 C) 0
 D) null
 Answer: B) false
21. What does the 'static' keyword mean in Java?
 A) It allows a method to be overridden.
 B) It allows a method or variable to be accessed without instantiating an object.
 C) It prevents a variable from being changed.
 D) It allows the method to be accessed by derived classes.
 Answer: B) It allows a method or variable to be accessed without instantiating
an object.
22. Which of the following is not a valid Java exception?
 A) NullPointerException
 B) IOException
 C) FileNotFoundException
 D) ArrayIndexOutOfBoundException
 Answer: D) ArrayIndexOutOfBoundException (Correct one is
ArrayIndexOutOfBoundsException)
23. What will be the output of the following Java code?
java
Copy code
String str = "Hello World";
System.out.println(str.substring(6, 11));

 A) Hello
 B) World
 C) World!
 D) ello
 Answer: B) World
24. Which of the following collections is synchronized in Java?
 A) ArrayList
 B) LinkedList
 C) Vector
 D) HashMap
 Answer: C) Vector
25. Which package is automatically imported into every Java program?
 A) java.io
 B) java.util
 C) java.lang
 D) java.net
 Answer: C) java.lang

HTML Questions
26. Which HTML tag is used to define a table row?
 A) <table>
 B) <td>
 C) <tr>
 D) <th>
 Answer: C) <tr>
27. Which HTML attribute is used to specify a unique identifier for an element?
 A) id
 B) class
 C) name
 D) style
 Answer: A) id
28. Which HTML tag is used to define an internal style sheet?
 A) <style>
 B) <script>
 C) <link>
 D) <head>
 Answer: A) <style>

CSS Questions
29. What is the correct CSS syntax to make all paragraphs bold?
 A) <p style="font-weight: bold">
 B) p {font-weight: bold;}
 C) p {text-size: bold;}
 D) <p style="text-size: bold
4o
What is the correct CSS syntax to make all paragraphs bold? A) <p style="font-weight: bold"> B) p
{font-weight: bold;} C) p {text-size: bold;} D) <p style="text-size: bold
To make all paragraphs bold using CSS, the correct syntax is:

B) p {font-weight: bold;}

Explanation:
 A) <p style="font-weight: bold">: This is incorrect because it's HTML with inline
CSS, not a CSS rule for styling all paragraphs globally.
 B) p {font-weight: bold;}: This is correct. It uses a CSS rule to set the font-weight
property of all <p> elements to bold.
 C) p {text-size: bold;}: This is incorrect because text-size is not a valid CSS
property. The correct property for making text bold is font-weight.
 D) <p style="text-size: bold">: This is incorrect for two reasons: text-size is not a
valid property, and it is using inline HTML styling instead of a CSS rule.
In CSS, the font-weight property is used to control the boldness of text. Setting it to bold makes
the text bold.
4o
give one unique mcq question of CSS
Here's a unique CSS MCQ question:

Question:
Which CSS pseudo-class would you use to style a link only when the user is actively clicking
on it?
A) :hover

B) :active

C) :focus

D) :visited

Answer:
B) :active

Explanation:
 A) :hover: This pseudo-class applies when the user designates an element (such as a link)
by pointing at it with a pointing device, but does not activate it.
 B) :active: This pseudo-class applies while an element (such as a link) is being activated
by the user (for example, between the times the mouse button is pressed and released).
 C) :focus: This pseudo-class applies while an element (such as a form input) has focus (is
ready to receive input from the user).
 D) :visited: This pseudo-class applies once the link has been visited.
4o

You might also like