Computer Science EngineeringVery hardISRO SC (CS)
The postfix expression 3 3 * 2 + 6 1 * * evaluates to:
- A. 67
- B. 66
- C. 69
- D. 63
Correct answer: B. 66
Scan left to right with a stack; for a - b pop b first, then a, and compute a - b. Result 66.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- int f(int x){ return x ^ (x >> 1); } What does f(201) return? (This is the binary-reflected Gray code.)
- Consider the following C fragment. int c=0; for(int i=0;i<15;i++) for(int j=i+1;j<15;j++) for(int k=j+1;k<15;k++) c++; What is c at the end?
- A DAG has vertices 1..6 and edges 1->2, 2->6, 3->4, 4->5. The number of distinct topological orderings is:
- How many structurally distinct binary trees (left and right children distinguished) with exactly 5 nodes have height exactly 3 edges?
- Job sequencing with deadlines (each job takes 1 unit; profit earned only if finished by its deadline). Jobs as (deadline, profit): (3,22)…
- Consider the following C fragment. int c=0; for(int i=1;i<=40;i=2) for(int j=1;j<=i;j++) c++; What is c at the end?