Exercise ::
Data Structures and Algorithms
1. | Which of these best describes an array? |
| |
| A. | A data structure that shows a hierarchical behaviour |
| B. | Container of objects of similar types |
| C. | Arrays are immutable once initialised |
| D. | Array is not a data structure |
|
|
| Answer: Option B |
|
|
| Explanation: |
|
Array contains elements only of the same type. |
| See More Information |
|
|
|
Tutorial Link: |
Published by:
2. | How do you initialize an array in C? |
| |
| A. | int arr[3] = (1,2,3); |
| B. | int arr(3) = {1,2,3}; |
| C. | int arr[3] = {1,2,3}; |
| D. | int arr(3) = (1,2,3); |
|
|
| Answer: Option C |
|
|
| Explanation: |
|
This is the syntax to initialize an array in C. |
| See More Information |
|
|
|
Tutorial Link: |
Published by:
3. | Process of inserting an element in stack is called ? |
| |
| A. | Create |
| B. | Push |
| C. | Evaluation |
| D. | Pop |
|
|
| Answer: Option B |
|
|
| Explanation: |
|
Push operation allows users to insert elements in stack. If stack is filled completely and trying to perform push operation stack overflow can happen. |
| See More Information |
|
|
|
Tutorial Link: |
Published by:
4. | Process of removing an element from stack is called ? |
| |
| A. | Create |
| B. | Push |
| C. | Evaluation |
| D. | Pop |
|
|
| Answer: Option D |
|
|
| Explanation: |
|
Elements in stack are removed using pop operation. Pop operation removes the top most element in the stack i.e. last entered element. |
| See More Information |
|
|
|
Tutorial Link: |
Published by:
5. | The postfix form of the expression (A+ B)*(C*D- E)*F / G is? |
| |
| A. | AB+ CD*E – FG /** |
| B. | AB + CD* E – F **G / |
| C. | AB + CD* E – *F *G / |
| D. | AB + CDE * – * F *G / |
|
|
| Answer: Option C |
|
|
| Explanation: |
|
(((A+ B)*(C*D- E)*F) / G) is converted to postfix expression as (AB+(*(C*D- E)*F )/ G) (AB+CD*E-*F) / G (AB+CD*E-*F * G/). Thus Postfix expression is AB+CD*E-*F*G/ |
| See More Information |
|
|
|
Tutorial Link: |
Published by:
Read More..
Online Test : Take an Online Data Structures and Algorithms Aptitude Test Now!