adplus-dvertising

Welcome to the Dynamic Programming MCQs Page

Dive deep into the fascinating world of Dynamic Programming with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Dynamic Programming, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Dynamic Programming, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Dynamic Programming. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Dynamic Programming. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Dynamic Programming MCQs | Page 22 of 22

Q211.
Consider the following dynamic programming implementation of the boolean parenthesization problem.
Which of the following lines should be added to complete the “if(op[pos] == ‘|’)” part of the code?
int count_bool_parenthesization(char *sym, char *op)
{
      int str_len = strlen(sym);
      int True[str_len][str_len],False[str_len][str_len];
      int row,col,length,l;
      for(row = 0, col = 0; row < str_len; row++,col++)
      {
          if(sym[row] == 'T')
          {
              True[row][col] = 1;
              False[row][col] = 0;
          }
          else
          {
              True[row][col] = 0;
              False[row][col] = 1;
          }
      }
      for(length = 1; length < str_len; length++)
      {
          for(row = 0, col = length; col < str_len; col++, row++)
          {
              True[row][col] = 0;
              False[row][col] = 0;
              for(l = 0; l < length; l++)
              {
                  int pos = row + l;
                  int t_row_pos = True[row][pos] + False[row][pos];
                  int t_pos_col = True[pos+1][col] + False[pos+1][col];
                  if(op[pos] == '|')
                  {
                      _______________;
                  }
                  if(op[pos] == '&')
                  {
                      _______________;
                  }
                  if(op[pos] == '^')
                  {
                      _______________;
                  }
              }
          }
      }
      return True[0][str_len-1];
}
Discuss
Answer: (d).False[row][col] += False[row][pos] * False[pos+1][col];
True[row][col] += t_row_pos * t_pos_col – False[row][pos] * False[pos+1][col];
Q212.
How many different insertion sequences of the key values using the same hash function and linear probing will result in the hash table shown above?
Discuss
Answer: (c).30
Q213.
If ' h ' is a hashing function and it is used to hash ' n ' keys into a table of size ' m ' where n <= m . What is the expected number of collisions involving a particular key ' x ' ?
Discuss
Answer: (a).less than 1.
Q214.
Hashing technique which allocates fixed number of buckets is classified as
Discuss
Answer: (c).external hashing
Q215.
Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that _ denotes an empty location in the table.
Discuss
Answer: (b).1, 8, 10, _, _, _, 3
Q216.
In linear hashing, formula used to calculate number of records if blocking factor, loading factor and file buckets are known is as
Discuss
Answer: (d).r =l * bfr * N
Q217.
Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is __________
Discuss
Answer: (a).80
Q218.
Which of these are core interfaces in the collection framework. Select the one correct answer.
Discuss
Answer: (d).Map

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!