Quiz
Data Structure Forum Quiz 1
This quiz has a time limit, so it opens in the usual player.
Questions in this quiz (25)
1Which of these best describes an array?
- AA data structure that shows a hierarchical behaviour
- BContainer of objects of similar types
- CArrays are immutable once initialised
- DArray is not a data structure
2How do you initialize an array in C?
- Aint arr[3] = (1,2,3);
- Bint arr(3) = {1,2,3};
- Cint arr[3] = {1,2,3};
- Dint arr(3) = (1,2,3);
3How do you instantiate an array in Java?
- Aint arr[] = new int(3);
- Bint arr[];
- Cint arr[] = new int[3];
- Dint arr() = new int(3);
4What is the output of the following piece of code?
public class array
{
public static void main(String args[])
{
int []arr = {1,2,3,4,5};
System.out.println(arr[2]);
System.out.println(arr[4]);
}
}- A3 and 5
- B5 and 3
- C2 and 4
- D4 and 2
5What is the output of the following piece of code?
public class array
{
public static void main(String args[])
{
int []arr = {1,2,3,4,5};
System.out.println(arr[5]);
}
}- A4
- B5
- CArrayIndexOutOfBoundsException
- DInavlidInputException
6When does the ArrayIndexOutOfBoundsException occur?
- ACompile-time
- BRun-time
- CNot an error
- DNot an exception at all
7Which of the following concepts make extensive use of arrays?
- ABinary trees
- BScheduling of processes
- CCaching
- DSpatial locality
8What are the advantages of arrays?
- Aa) Objects of mixed data types can be stored
- Bb) Elements in an array cannot be sorted
- Cc) Index of first element of an array is 1
- Dd) Easier to store elements of same data type
9Assuming int is of 4bytes, what is the size of int arr[15];?
- A15
- B19
- C11
- D60
10Process of inserting an element in stack is called ____________
- ACreate
- BPush
- CEvaluation
- DPop
11Process of removing an element from stack is called __________
- ACreate
- BPush
- CEvaluation
- DPop
12In a stack, if a user tries to remove an element from empty stack it is called _________
- AUnderflow
- BEmpty collection
- COverflow
- DGarbage Collection
13Pushing an element into stack already having five elements and stack size of 5, then stack becomes
- AOverflow
- BCrash
- CUnderflow
- DUser flow
14Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(())) are:
a) 1
b) 2
c) 3- A1
- B2
- C3
- D4 or more
15What is the value of the postfix expression 6 3 2 4 + – *:
- A1
- B40
- C74
- D-18
16Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to convert the expression from infix to postfix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?- A1
- B2
- C3
- D4
17The data structure required to check whether an expression contains balanced parenthesis is?
- Aa) Stack
- Bb) Queue
- Cc) Array
- Dd) Tree
18What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?
- ALinked List
- BStack
- CQueue
- DTree
19What is the result of the following operation?
Top (Push (S, X))- AX
- BX+S
- CS
- DXS
20The prefix form of an infix expression (p + q) – (r * t) is?
- A+ pq – *rt
- B– +pqr * t
- C– +pq * rt
- D– + * pqrt
21The postfix form of A*B+C/D is?
- A*AB/CD+
- BAB*CD/+
- CA*BC+/D
- DABCD+/*
22Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the number of elements present in stack are- A1
- B2
- C3
- D4
23Which of the following is not an inherent application of stack?
- AReversing a string
- BEvaluation of postfix expression
- CImplementation of recursion
- DJob scheduling
24The type of expression in which operator succeeds its operands is?
- AInfix Expression
- BPrefix Expression
- CPostfix Expression
- DBoth Prefix and Postfix Expressions
25If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?
- AABCD
- BDCBA
- CDCAB
- DABDC
Information
- Description
- Quiz on Data Structure Forum Quiz 1, created by raghu Katagall on 08/11/2019.
- Author
- raghu Katagall
- Language
- English
- Views
- 129
- Tags
- Rating
- No ratings yet Rate this quiz