Pseudo Code Questions- Shift Operators - Tricks to Solve

Duration: 10 min

This video lesson is available to enrolled students.

Enroll to watch — AMCAT Superset

AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This educational video is a lecture on solving multiple-choice questions (MCQs) related to pseudo code, focusing on integer arithmetic and bitwise operations. The instructor, Yash Jain, presents three distinct problems, each from a different company's exam (Capgemini, Accenture, Adobe). The first problem involves integer division and a left shift operation, where the output is calculated as 64. The second problem demonstrates a loop that doubles a value until it exceeds a limit, resulting in an output of 64. The third problem features a for loop that iterates from 0 to 3, summing the loop variable, which yields an output of 6. The video uses a digital blackboard for step-by-step calculations and includes a live coding demonstration in an online C compiler to verify the results. The lecture concludes with the instructor speaking directly to the camera.

Chapters

  1. 0:00 2:00 00:00-02:00

    The video opens with a title slide for a lecture on "PSEUDO CODE MCQs" by Yash Jain. The instructor then presents the first problem, which is from Capgemini 2020. The pseudo code is displayed on a digital blackboard: it declares three integer variables (x, y, z), sets x=24 and y=8, performs integer division x = x/y (resulting in x=3), and then calculates z = y << x (a left shift operation). The instructor begins to solve the problem by writing the initial values and the division step, showing x = 24 / 8 = 3.

  2. 2:00 5:00 02:00-05:00

    The instructor continues solving the first Capgemini problem. He explains the left shift operation, writing the formula z = y << x, which is equivalent to z = 8 << 3. He then calculates this as 8 * 2^3, which is 8 * 8 = 64. He writes the final answer, z = 64, on the board. The video then transitions to a live coding environment, the OnlineGDB, where the C code corresponding to the pseudo code is shown. The instructor runs the code, and the output displayed in the console is 64, confirming the manual calculation.

  3. 5:00 10:00 05:00-10:00

    The video moves to the second problem, from Accenture 2017. The pseudo code is shown: it initializes value=1 and n=45, then enters a while loop that continues as long as value <= n. Inside the loop, value is updated to value << 1 (i.e., value = value * 2). The instructor walks through the iterations: value starts at 1, then becomes 2, 4, 8, 16, 32. The next iteration would make it 64, which is greater than 45, so the loop terminates. The final value of the variable is 64, which is printed. The instructor then demonstrates this in the OnlineGDB compiler, where the output is again 64.

  4. 10:00 10:18 10:00-10:18

    The video presents the third and final problem, from Adobe 2016. The pseudo code shows a for loop: for i from 0 to 4<<0 (which is 4). The loop variable i takes values 0, 1, 2, 3. The variable count is initialized to 0 and is incremented by i in each iteration. The instructor calculates the sum: 0 + 1 + 2 + 3 = 6. The final output is 6. The video then cuts to the instructor speaking directly to the camera, concluding the lecture.

The video provides a structured, step-by-step analysis of three different pseudo code MCQs, each illustrating a core programming concept. The first problem demonstrates integer division and the left shift operator, which is a fundamental bit manipulation technique. The second problem reinforces the concept of a while loop and the exponential growth of a variable through repeated multiplication by two. The third problem focuses on a for loop and the summation of a sequence of numbers. The consistent use of a digital blackboard for manual calculation and a live coding environment for verification ensures a comprehensive understanding of the logic and the final output for each problem.

Loading lesson…