On account of the disruption in education due to the corona pandemic, we're opening up our platform for teachers, free of cost. Know More →

IBPS > Data Structure Compiler

Explore popular questions from Data Structure Compiler for IBPS. This collection covers Data Structure Compiler previous year IBPS questions hand picked by experienced teachers.

Q 1.

Correct1

Incorrect-0.25

Two main measures for the efficiency of an algorithm are

A

Processor and memory

B

Complexity and capacity

Time and space

D

Data and space

E

None of these

Explanation

Time and space

Q 2.

Correct1

Incorrect-0.25

The time factor when determining the efficiency of algorithm is measured by

A

Counting microseconds

Counting the number of key operations

C

Counting the number of statements

D

Counting the kilobytes of algorithm

E

None of these

Explanation

Counting the number of key operations

Q 3.

Correct1

Incorrect-0.25

The space factor when determining the efficiency of algorithm is measured by

Counting the maximum memory needed by the algorithm

B

Counting the minimum memory needed by the algorithm

C

Counting the average memory needed by the algorithm

D

Counting the maximum disk space needed by the algorithm

E

None of these

Explanation

Counting the maximum memory needed by the algorithm

Q 4.

Correct1

Incorrect-0.25

Which of the following case does not exist in complexity theory

A

Best case

B

Worst case

C

Average case

Null case

E

None of these

Explanation

Null case

Q 5.

Correct1

Incorrect-0.25

The Worst case occur in linear search algorithm when

A

Item is somewhere in the middle of the array

B

Item is not in the array at all

C

Item is the last element in the array

Item is the last element in the array or is not there at all

E

None of these

Explanation

Item is the last element in the array or is not there at all

Q 6.

Correct1

Incorrect-0.25

The Average case occur in linear search algorithm

When Item is somewhere in the middle of the array

B

When Item is not in the array at all

C

When Item is the last element in the array

D

When Item is the last element in the array or is not there at all

E

None of these

Explanation

When Item is somewhere in the middle of the array

Q 7.

Correct1

Incorrect-0.25

The complexity of linear search algorithm is

{tex}O(n){/tex}

B

{tex}O(log ){/tex}

C

{tex}O(n^2){/tex}

D

{tex}O(n log n){/tex}

E

None of these

Explanation

{tex}O(n){/tex}

Q 8.

Correct1

Incorrect-0.25

The complexity of Binary search algorithm is

A

{tex}O(n){/tex}

{tex}O(log ){/tex}

C

{tex}O(n^2){/tex}

D

{tex}O(n log n){/tex}

E

None of these

Explanation

{tex}O(logn){/tex}

Q 9.

Correct1

Incorrect-0.25

The complexity of Bubble sort algorithm is

A

{tex}O(n){/tex}

B

{tex}O(log n){/tex}

{tex}O(n^2){/tex}

D

{tex}O(n log n){/tex}

E

None of these

Explanation

{tex}O(n^2){/tex}

Q 10.

Correct1

Incorrect-0.25

Each array declaration need not give, implicitly or explicitly, the information about

A

the name of array

B

the data type of array

the first data from the set to be stored

D

the index set of the array

E

None of these

Q 11.

Correct1

Incorrect-0.25

If the sequence of operations - push(1), push(2), pop, push (1), push(2), pop, pop, pol , push(2), pop are preformed on a stack, the sequence of popped out values are ?

2, 2, 1, 1, 2

B

2, 2, 1, 2, 2

C

2, 1, 2, 2, 1

D

2, 1, 2, 2, 2

E

None of these

Explanation

The elements are popped from the top of the stack.

Q 12.

Correct1

Incorrect-0.25

A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time needed to sort 100 names will be approximately ?

A

50.2 sec

6.7 sec

C

72.7 sec

D

11.2 sec

E

None of these

Explanation

In the best case quick sort algorithm makes n log(n) comparisons so 1000 x log (1000) = 9000 comparisons, which takes 100 sec. To sort 100 names a minimum of 100 log (100) = 600 comparisons are needed . This takes 100 x 600/9000 = 6.7 sec.

Q 13.

Correct1

Incorrect-0.25

The number of binary trees with 3 nodes which when traversed in post order gives the sequence A,B, C is ?

A

3

B

9

C

7

5

E

None of these

Explanation

Q 14.

Correct1

Incorrect-0.25

The average search time of hashing with linear probing will be less if the load factor ?

is far less than one

B

equals one

C

is far greater than one

D

All of the above

E

None of these

Explanation

Load factor is the ratio number of records that are currently present and the total number of records that can be present. If the load factor is less free space will be more. This means probability of collision is less. So the search time will be less.

Q 15.

Correct1

Incorrect-0.25

A binary tree that has n leaf nodes. The number of nodes of degree 2 in this tree is ?

A

{tex}log_2n{/tex}

{tex}n - 1{/tex}

C

{tex}n{/tex}

D

{tex}2^n{/tex}

E

None of these

Explanation

It can be proved by induction that a binary tree with n leaf nodes will have total of {tex}2n - 1{/tex} nodes. So number of non-leaf nodes is {tex}(2n - 1)-n = n- 1{/tex}

Q 16.

Correct1

Incorrect-0.25

As part of maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be ?

A

Bubble sort

Insertion sort

C

Selection sort

D

Heap sort

E

None of these

Q 17.

Correct1

Incorrect-0.25

The way a card game player arranges his cards as he picks them up one by one, is an example of ?

A

bubble sort

B

selection sort

insertion sort

D

merge sort

E

None of these

Explanation

He scans throught the rest of the cards and pick the one with least value and places it next to the point till which he has already sorted the cards

Q 18.

Correct1

Incorrect-0.25

Linked lists are suitable for which of the following problems?

A

Insertion sort

Binary search

C

Radix sort

D

Polynomial manipulation

E

None of these

Explanation

Through Linked list binary search can be performed efficiently.

Q 19.

Correct1

Incorrect-0.25

The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?

Finite state automata

B

Deterministic push down automata

C

Non-deterministic push down automata

D

Turing machine

E

None of these

Explanation

Finite state automata.

Q 20.

Correct1

Incorrect-0.25

In a compiler, keyboards of a language are recognized during

A

parsing of the program

B

the code generation

the lexical analysis of the program

D

data flow analysis

E

None of these

Explanation

the lexical analysis of program.

Q 21.

Correct1

Incorrect-0.25

Which data structure in a compiler is used for managing information about variables and their attributes?

A

Abstract syntax-tree

Symbol table

C

Semantic stack

D

Parser table

E

None of these

Explanation

Symbol table is a data structure in a compiler. It was devised for the purpose that it can be used to manage information about variable and their attributes. Example Symbol table.

Q 22.

Correct1

Incorrect-0.25

Some code optimizations are carried out on the intermediate code because

A

they enhance the portability of the compiler to other target processors

B

program analysis is more accurate on intermediate code than on machine code

C

the information from data flow analysis cannot be used for optimization

the information from the front end cannot be used for optimization

E

None of these

Explanation

Code optimizations are generally carried out on intermediate code. This is done to convert the source code to the machine language of the target machine on the basis of back end tools. It enhances the portability of the compilers to the other target processors.

Q 23.

Correct1

Incorrect-0.25

Which of the following are true?
1. A programming language which does not permit global variables of any kind and has no nesting of procedures/ functions, but permits recursive can be implemented with static storage allocation
2. Multi-level access link (or display) arrangement is needed to arrange activation records only, if the programming language being implemented has nesting of procedures/functions.
3. Recursion in programming languages cannot be implemented with dynamic storage allocation
4. Nesting of procedures/functions and recursion require a dynamic heap allocation scheme and cannot be implemented with a stack-based allocation scheme for activation records.
5. Programming languages which permit a function to return a function as its result cannot be implemented with a stack based storage allocation scheme for activation records

A

2 and 5

B

1, 3 and 4

C

1, 2 and 5

2, 3 and 5

E

None of these

Explanation

Statement 1 True: A programming language which does not permit global variables of any kind has no nesting of procedures/fimctions, but permits recursion can be implemented with static storage allocation.
Statement 2 False: It is not necessary to have nesting of procedures/function in the programming language being implemented when activation records are arranged using multi level access link.
Statement 3 True: Recursion in programming language cannot be implemented with dynamic storage allocation.
Statement 4 : False Nesting of procedures/fimctions and recursion can be implemented with a stack based allocation scheme for activation.
Statement 5 True:The programming languages which permit a function to return a function as its result cannot be implemented with a stack based storage allocation scheme for activation records.

Q 24.

Correct1

Incorrect-0.25

The grammar {tex}A\rightarrow AA | (A) | \epsilon {/tex} is not suitable for predictive-parsing because the grammar is

A

ambiguous

left-recursive

C

right-recursive

D

an operator grammar

E

None of these

Explanation

Since given grammar can have infinite parse trees for string ‘ε’, so grammar is ambiguous, and also A → AA has left recursion. For predictive-parsing, grammar should be: Free from ambiguity Free from left recursion Free from left factoring Given grammar contains both ambiguity and left factoring, so it can not have predictive parser. We always expect first grammar free from ambiguity for parsing. Option (A) is more strong option than option (B) here.

Q 25.

Correct1

Incorrect-0.25

Consider the grammar {tex}S \rightarrow (S)|a{/tex}
Let the number of states in SLR (1), LR(1) and LALR (1) parsers for the grammar be {tex}n_1, n_2{/tex} and {tex}n_3{/tex} respectively. Which of the following relationships holds good?

A

{tex}n_1 < n_2 < n_3{/tex}

{tex}n_1 = n_3 < n_2{/tex}

C

{tex}n_1 = n_2 = n_3{/tex}

D

{tex}n_1\quad n_3\quad n_2{/tex}

E

None of these

Explanation

Number of states is equal to SLR and LALR.
LRhave more number of states then the two due to the look ahead.
Let the number of states for SLR (1) be {tex}n_1{/tex}.
Number of states for LR(1) be {tex}n_2{/tex}.
Number of states for LALR(1) be n3.
Then, {tex}n_1 =n_3