Let’s reset your expectations: Programming Fundamentals isn’t about learning a language. It’s about learning to think in a new way. This past paper isn’t a test of syntax memorization; it’s a test of your ability to translate a messy, real-world problem into a clear, step-by-step sequence of logical instructions that a mindless machine can execute flawlessly. It’s where you stop being a user and start being a creator.

Forget fancy frameworks and shortcuts. This is the pure, raw core of computational thinking. It’s about building the mental muscles of problem decomposition, precise expression, and relentless debugging.

What This Paper Actually Builds: Your Computational Core

1. The Paradigm Shift: From Human to Machine Thinking
The first hurdle is mental. The paper assesses if you’ve made the leap:

  • Imperative Thinking: You must think in sequencesdecisions, and repetitions. The world is no longer a static picture; it’s a series of state changes.
  • Abstraction: Can you ignore irrelevant details and focus on the essential logic? This is the skill of seeing the general pattern in a specific problem.
  • Precision & Literalness: The computer does exactly what you tell it, not what you mean. A misplaced semicolon or an off-by-one error isn’t a “typo”; it’s a fundamental flaw in your logic.

2. The Foundational Toolkit: The Atoms of Code
You’ll be tested on your fluency with the basic constructs that combine to form any program.

  • Variables & Data Types: Understanding that a variable is a named container, not an algebra symbol. Knowing the difference between intfloatcharstring, and boolean at a conceptual level—what they can hold and how they behave.
  • Control Flow: The three pillars of structured programming:
    1. Sequence: Statements executed in order.
    2. Selection (ifelse ifelseswitch): Making decisions.
    3. Iteration (forwhiledo-while): Repeating actions. You’ll trace loops meticulously, often by constructing “trace tables” to track variable values step-by-step.
  • Basic Data Structures: Primarily arrays (or lists). Understanding indexing (starting at 0!), bounds, and using loops to process them (searching for a value, finding a max/min, computing an average).

3. The First Major Abstraction: Functions/Methods
This is where you learn to manage complexity by breaking it down.

  • The “Black Box” Principle: A function takes input (parameters), performs a task, and returns output. You must understand scope (local vs. global variables), passing arguments by value (and sometimes by reference), and the power of return.
  • Why Functions? For reusability, organization, and making your code readable. You’ll be asked to write functions for common tasks (e.g., isPrime(number)findMax(array)).

4. Problem-Solving Methodology: The Real Skill
The paper’s primary goal is to test your problem-solving process, not just your final code.

  • Step 1: Understanding the Problem. Can you restate it in your own words? Identify inputs and desired outputs?
  • Step 2: Devising a Plan (Algorithm). This is the critical, non-coding step. You’ll develop pseudocode or a flowchart. This is where you think.
  • Step 3: Translating to Code. Implementing your plan in a specific language (like C++, Java, or Python basics).
  • Step 4: Testing & Debugging. Given code with errors, you must dry-run it (execute it in your head) to find logical bugs (== vs =, infinite loops, incorrect loop conditions).

5. Introduction to the Debugger’s Mindset
You’ll encounter questions where you’re given a buggy code snippet and the wrong output. Your job is to:

  1. Identify the line where the logic fails.
  2. Explain the nature of the bug (e.g., “The loop condition is i <= length, causing an out-of-bounds access; it should be i < length.”).
  3. Correct it.

The Paper’s Real Challenge: The “Code Reading” and “Plan Writing”
The hardest parts for beginners are often not the writing, but:

  • Tracing Code: Given a block of code with nested loops and if statements, you must manually execute it and write the exact output. This forces complete understanding.
  • Writing Algorithms in Pseudocode: Being asked to describe the steps to solve a problem (e.g., “Find the second largest number in an array”) without using any specific programming syntax. This tests pure logic.

How to Ace This Past Paper:

  1. Practice Dry-Running Religiously. Take code, a paper, and a pen. Be the computer. Write down the value of every variable after every line. This is the single most important skill.
  2. Master Pseudocode. Write your solutions in plain English mixed with basic logic structures first. The language-specific code should be the easy final step.
  3. Become an Expert on Loops and Arrays. 80% of fundamental problems involve processing data in a loop. Know how to iterate forwards, backwards, and conditionally.
  4. Draw Diagrams. For complex logic, sketch a quick flowchart. Visualizing the flow of control is invaluable.
  5. Read the Problem, Then Re-Read It. Underline key inputs, outputs, and conditions. Many errors come from solving a different problem than the one asked.

This past paper is your initiation rite. It’s proof that you have successfully rewired a part of your brain to think sequentially, precisely, and algorithmically. Passing it doesn’t mean you know a language; it means you have acquired the fundamental skill of programming—a skill you will use, in some form, for the rest of your technical career.

Programming Fundamental Final Paper

Q1:

  1. Write down the difference between compiler and interpreter?
  2. Write down difference between operator precedence and operator associativity in C++?
  3. Write down the code for the following output using for loop?

Q2: Write a program that repeatedly collects positive integers from the user, stopping when the user enters a negative number or zero. After that, output the product of all positive entries?

Q3: Input three integer numbers and find the middle number of three integers.

Hint1: 23 54 35                  Hint2: 40 23 50                  Hint3: 34 54 65

Middle No is: 35                Middle No is: 40               Middle No is: 54

Q4: Write a program in C++ to display the number’s digits in reverse order?

Sample output:

Input a number: 12345

The number in reverse order is: 54321

Postcolonial Literature Sessional I in past paper
ATTEMPT ALL QUESTIONS.

Q1

Write a program that inputs radius from the user and calculates area and circumference of a circle by using the formula Area- pix (radius)² & Circumference = 2 x pi x radius (3)

Q-2

Draw flowchart for a program that inputs three integer numbers and displays the smallest number by using nested if structure.

Q-3

a) Write a code with flowchart that finds the sum of the squares of integers from I to 100.

b) Compare if, if-else-if and nested if structures(3)

Postcolonial Literature Sessional II in past paper

Q1

Write a program that inputs five integers in an array and passes array to a function. The function counts total number of even and odd numbers and returns to main function to display it(10)

Q-2 Write a program that inputs values in a two dimensional array with three rows and two columns, The function returns the maximum value in the array. (5)

Q-3 Write a program for matrix A that inputs following elements & arrange these elements shown in matrix B as under:–.

Q-4 Write a program that inputs ten floating point numbers in an array. It displays the values which are greater or equal or less than average value of this array. (10)

Postcolonial Literature Final paper
Q-1: Study the following code segments and write the output [2.5° 2-5).

int N = 7; int i, x;

for (= 1; i <= N; i++) {

cin >> x; cout <<<< “, ” << X << ” “; if(1 % 3= 0) { cout << endl; }

int arr[5]-{0,1,0,1,1); int sum-0,p=0; for (int i=0;i<5;i++){ sam-sum+pow(2.p) arr[1];

cout << endl what is displayed with the given input? watch the end 1 characters.

p++;

}

cout<<sum<<<endl;

Input: 11 12 13 14 15 16 17 18 19

Q-2: Rewrite the following C++ code segments to make it more efficient and to remove any unnecessary code. [2.5* 2-5).

if (x <yly >= x) { cout <<

“Not good. \n”; }

cout << “Carry on.\n”;

if (x / y != 0 && y != 0) { cout << x/y << endl; }

Q-3: Write a C++ program to find k largest elements in a given array of integers. [5]

Data Structure and Algorithms

  1. Write an algorithm to delete even valued elements from an integer type array,
  2. Suppose an array A containing ten integers as shown, Draw the resultant array after implementing the given loop in each part. (In part-b use the given array, not the resultant array of part-a)
102030405060708090100
Part-aPart-b
Repeat for kß1 to 9A[K+1] ß A[K]Kß 9Repeat while (K>=1)A[K+1] ß A[9]Kß K-1

iii. Using binary search technique show how it works when searching for 17 in the

following array. (Assume indexing starts from 1 to 9)

15691012141721

Question No. 2: Write short answers of questions given bellow:

  1. What are the types of asymptotic notations?
  2. Which asymptotic notations specifically describes best and average case scenarios?

Write difference between traversing and searching

Define the situations when insertion in an array becomes best and worst.

Postcolonial Literature Sessional I in past paper

Leave a Reply

Your email address will not be published. Required fields are marked *