# Programming Fundamentals Past Papers – University

## Programming Fundamentals Past Papers – University

Here, we are showing you a sample of past paper of programming fundamental. If your student of a university and want to get an idea of the paper. Then this is a great sample paper for you.

### Programming Fundamentals – Paper 1

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 60 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Q.1. Write the output of the following segments of codes [6*3=18].

A.

B.

C.

D.

E.

F.

1. 2. Briefly comment each of the following lines of code. The first line is done for you. Make sure you describe the difference between statements. 

Q.3.(10 points) We know that when an array is defined a constant pointer is created which stores the starting address of an array.  For example

float arr={10,20,30,40,50,60};

a constant pointer,  with the name of ‘arr’, is created as given below: Consider the above diagram and calculate:arr+3 and *(arr+3)If the type of the above-mentioned array is an integer instead of float then calculate arr+3 and *(arr+3)Q.4. Write a function to print the following series where n is input by the user in the main function. The limit should be inputted through the keyboard and will be passed to function as an argument.           1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/nQ.5. Write a recursive function to obtain the running sum of the first 100 natural numbers.Q.6. Create a structure named Student to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. (a) Write a function to print names of all students who joined in a particular year. (b) Write a function to print the data of a student whose roll number is given. Q.7. Differentiate the following:[2×4=8]a) Actual Parameters and Formal Parametersb) Parameter passing by value and by the pointer

### Programming Fundamentals – Paper 2

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 60 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Instruction:

1. All questions are compulsory.

Q#1

What is pointer variable? Explain the working of pointer variable?                                    (10)

Q#2

Write a program that declares a STRUCTURE to store roll nos. and marks of 5 subjects in a single array. The program should define a structure variable, inputs the values and displays roll no, marks and average marks?                                                                                            (10)

Q#3

Write a program to initialize 3 different strings and perform the following functions:

1. Copy STRING1 into STRING3 (5)
2. Concatenate STRING1 and STRING2 (5)
3. Calculate and show the total length of STRING1 after concatenation. (5)

Q#4

1. Differentiate between actual and formal parameter?                                     (5)
2. Write a program that displays back-counting from 10 to 1 by incorporating the(do while loop, function calls, function declaration, function definition, and global variable) concepts in your program.                                                                                        (10)

Q#5     Write a program to initialize the array with 5 values and the sort the values with

selection sort?                                                                                                            (10)

 Program %age of LB covered prior Mid-Term %age of LB expected to be covered priorFinal-Term Question Paper Weight Prior Mid    +    After Mid %age of Objective Questions MCS-1A 50% 50% After Mid 100% Nill

### Programming Fundamentals – Paper 3

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 35 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Q1:                                                                                                                              (10)

Write a program to bubble sort the values in an array?

Q2:                                                                                                                              (10)

Write a program to calculate the sum of the following series using do while loop.

1+1/2+1/4+1/6+1/8+…………………..+1/100

Instructions: Use the user define functions.

Q3:                                                                                                                              (5)

Write a program to display the following output.

100                  10                    120

80                    30                    150

60                    50                    180

Instructions:

Use the user define functions.

Use the struct

Q4:                                                                                                                              (5)

Write a program that takes inputs from the user within a described range, and then adds only the odd numbers within the array.

Instructions:

Use the Global Variable

Use  For loop

Use user define a function

Q5:                                                                                                                              (5)

Write a program that takes the built-in functions of string to concatenate, and copies the strings.

### Programming Fundamentals – Paper 4 Practical

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 20 (points) Date & Time: Confidential Total Time:  30 Minutes Student’s Name: Reg. No:

Q1:                                                                                                                                          (10)

Write a program to generaFibonaccibonacci numbers in an array within the given range, and then add all the indexes within the array, and show the final sum.

Q2:                                                                                                                                          (10)

Demonstration of practical/project performed in computer Lab.

### Programming Fundamentals – Paper 5

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 35 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Q#1     Write a program that takes two numbers from the user as an input, and then demonstrates the working of a calculator using a switch statement?                7 Marks

Hint: Calculator working is like addition, multiplication, subtraction of two numbers

Q#2     Write a program to swap two variables without using a third variable?      7 Marks

Q#3     Write a program to find the factorial of a number using while loop?          7 Marks

Q#4     Write a program that displays the following shape using nested for loop?

*

*  *

*  *   *                                                                                                                       7 Marks

Q#5                                                                                                                 3+3+2=8 Marks

1. Makes an observation to detect that this code is error free or not? If you find errors, then explain what the errors in this code are.

Do{Cout<<”enter a number”<<Endl;

}While(number < 10)

1. Write two different techniques to declare and initialize a variable with an example?
2. What is the difference between while and do while loop?

### Programming Fundamentals – Paper 6

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 35 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Q#1     Write a program that takes a number from the user and then shows that number is even or odd?                                                                                                                                                                                 7 Marks

Q#2     Write a program (starting from #include) 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.                                                                                                                                                                                              6 Marks

Q#3     Write a program to find the factorial of a number using for loop?                                      7 Marks

Q#4     Write a program that takes the maximum range for calculating the Fibonacci and then to calculate the Fibonacci series of numbers.

Hint : Fibonacci series is like 1,1,2,3,5,8,13,21,…….till range            .

e.g, if a user enters a range of 5 then first five should be calculated only,

like 1,1,2,3,5,8 11                                                                                                                            7 Marks

Q#5                                                                                                                                        5+3=8 Marks

1. Write the minimum five rules for naming a variable?
2. Write two different techniques to declare and initialize a variable with an example?

### Programming Fundamentals – Paper 7 -Practical

 Course Code: Confidential Course Title: Programming Fundamentals Teacher’s Name: Confidential Total Marks: 20 (points) Date & Time: Confidential Total Time:  2 Hours Student’s Name: Reg. No:

Instruction:

1. All questions are compulsory.

Q#1

Write a program that initializes ten values within an array and sort the array

with bubble sort?                                                                                                                    (10)

Q#2

Write a program that gets the values in two-dimensional array, and after getting the values, the program should show the values.                                                                                                                             (10)