Friday 18 August 2023

Daily Coding Problem (18-8-2023)

 Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

You are given an array of nonnegative integers. Let's say you start at the beginning of the array and are trying to advance to the end. You can advance at most, the number of steps that you're currently on. Determine whether you can get to the end of the array.

For example, given the array [1, 3, 1, 2, 0, 1], we can go from indices 0 -> 1 -> 3 -> 5, so return true.

Given the array [1, 2, 1, 0, 0], we can't reach the end, so return false.

You can write the program in any programming language.

Monday 7 August 2023

Operation Research MCQ

 1. What type of approach does operation research have?

a) multi-disciplinary     b) scientific                 c) intuitive             d) all of the above

2. OR approach is typically based on the use of

a) Physical model b) Mathematical model c) Iconic model d) Descriptive model

3. Which of the following is not a characteristic of the LP model?

a) alternative courses of action

b) an objective function of maximization type

c) limited number of resources

d) non-negativity condition on the value of decision variables

4. What is the objective function in linear programming problems?

a) A constraint for available resource

b) An objective for research and development of a company

c) A linear function in an optimization problem

d) A set of non-negativity conditions

5. Which statement characterizes standard form of a linear programming problem?

a) Constraints are inequalities of any type b) Constraints are a set of linear equations

c) Constraints are inequalities of >= type d) Constraints are inequalities of <= type

6. In graphical representation, what is the name of the bounded region?

a) solution b) basic solution c) feasible solution d) optimal solution

7. If two constraints do not intersect in the positive quadrant of the graph, then ____________.

a) the problem is infeasible                             b) the solution is unbounded

c) one of the constraints is redundant             d) none of the above

8. What type of LPP can be solved using graphical method?

a) LPP with two decision variables b) LPP with three decision variables

c) LPP with one decision variable         d) LPP with any number of decision variables

9. How many columns will there be in the Simplex table, if there are ‘M’ original variables and ‘n’ introduced variables?

a) M + n b) M - n c) M + n + 1 d) M + n - 1

10. Name the variable that is added to the constraints of type ‘=’.

a) surplus variable b) dummy variable c) slack variable d) artificial variable

11. If all aij values in the entering variable column of the simplex table are negative, then ______________.

a) solution is unbounded                         b) solution is degenerate

c) there exists no solution                 d) there are multiple solutions

12. A BFS of an LPP is said to be ________, if at least one of the basic variables is zero.

a) Infeasible b) non-degenerate c) Feasible d) Degenerate

13. A minimization problem can be converted into a maximization problem by changing the sign of coefficients in the ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐

a) objective function only                             b) constraints only

c) both objective function and constraints     d) basis variables only

14. All the constraints are expressed as equations and the right-hand side of each constraint, and all variables are non-negative is called _______

a) Standard form of LPP                 b) Simplex form of LPP

c) Canonical form of LPP                 d) General form of LPP

15. If dual has an unbounded solution, primal has _________.

a) no feasible solution b) unbounded solution c) feasible solution d) an optimal solution

16. If a primal LP problem has a finite solution, then the dual LP problem should have __________.

a) finite solution     b) infeasible solution c) unbounded solution d) feasible solution

17. The dual of the dual is ______________.

a) dual-primal b) primal-dual c) primal d) dual

18. How are the dual constraints for the maximization LP problem written?

a) Σ aij yi ≥ cj             b) Σ aji yi ≥ cj         c) Σ aij yi ≤ cj                     d) Σ aji yi ≤ cj

19. The right-hand side constant of a constraint in a primal problem appears in the corresponding dual as __________.

a) a coefficient in the objective function b) a right-hand side constant of a constraint

c) an input-out coefficient                         d) none of the above

20. Variable in dual problem which can assume negative values, positive values or zero value is classified as _________________.

a) slack variable     b) restricted variable c) unrestricted variable d) decision variable

21. The dummy source or destination in a transportation problem is added to _____________ 

a) satisfy rim conditions                                             b) prevent solution from becoming degenerate

c) ensure that total cost does not exceed a limit     d) the solution not be degenerate

22. Which of the following methods is used to verify the optimality of the current solution of the transportation problem?

a) Least cost method                                         b) Vogel’s approximation method

c) North-west corner method                                 d) Modified Distribution Method

23. If demand is lesser than supply then dummy demand node is added to make it a __________

a) Simple problem                                                     b) Balanced problem

c) Transportation problem                                     d) Assignment problem

24. One disadvantage of using North-West Corner rule to find initial solution to the transportation  problem is that ___________.

a) It is complicated to use                                 b) It does not consider cost of transportation

c) It leads to a degenerate initial solution         d) It does not lead to optimal solution

25. In an assignment problem involving 5 workers and 5 jobs, total number of assignments possible are ______________

a) 10             b) 25                                 c) 5                                    d) 1

26. In assignment problem of maximization, the objective is to maximize the _______.

a) cost     b) time                         c) profit                           d) loss

27. Both transportation and assignment problems are members of a category of LP problems called ______

a) shipping problems                     b) network flow problem

c) logistic problems                     d) routing problems

28. In sensitivity analysis of the coefficient of the non-basic variable in a cost minimization LP problem, the upper sensitivity limit is ________________.

a) original value + Lowest positive value of improvement ratio

b) original value – Lowest absolute value of improvement ratio

c) positive infinity

d) negative infinity

29. The entering variable in the sensitivity analysis of objective function coefficients is always a ____.

a) decision variable         b) non-basic variable c) basic variable d) slack variable

30. A change in the objective function for a non-basic variable can affect _____________.

a) cj – zj values of all non-basic variables             b) cj – zj values of all basic variables

c)  Only the cj – zj value of that variable                     d) the initial basic feasible solution


ANSWER

1.a

2.  b

3.  b

4. c

5. a

6. c

7. a

8. a

9. a

10. d

11. a

12. d

13. a

14. c

15. a

16. a

17. c

18.  b

19.  a

20. c

21. a

22. d

23. b

24. b

25. c

26. c

27. b

28. c

29. d

30. c