Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PF_Assignment # 03

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

University of Management and Technology,

Lahore Campus

Assignment # 03 – Fall 2024


Credit
Course Name: Programming Fundamentals Course Code: CC1021 3(2,1)
Hours:
Course
Mr. Shahbaz Qadeer Program Name BS Computer Science
Instructor/s:
Maximum
Semester/ Section: BSCS 1st 10
Marks:
Submission Moderator
Jan 09 , 2025
Deadline: Signature
Instructions:
 Understanding the problems is a part of the assignments.
 Create a file where you'll write only the question numbers (e.g., Question No. 1) and answer of
that Question. Then, convert the file into PDF format and upload it.
 Your assignment should be submitted in PDF format.
o (File name should be your name and ID like (ALI ASLAM_F2017065100)).
 There is a ZERO tolerance policy for plagiarism. Assignments found with copy-pasted material or
 copied from fellows will be marked as ZERO.
 Submit your assignments on your LMS portal within the given time frame.
 The assignment assessment will be based on your effort.
 I can take either quiz or in class viva for this assignment by calling any one from the class.

Questions: CLO-1, CLO-2, CLO-3

Page 1 of 8
Trace the output of the following piece of code:

Question No. Sample Code

Page 2 of 8
4

Page 3 of 8
7

Page 4 of 8
9

10

11

Page 5 of 8
12

13

14

Page 6 of 8
15

16

17. Write a program that inputs the number of rows and columns from the user. It
then inputs the elements to store in the matrix. The program calculates the sum of
each row and each column and displays on the screen. If it is a square matrix, it
also calculates the sum of diagonal elements and displays it on screen.

18. Write a program that prompts the user to enter a number and reverse it. Write a
function Reverse() to reverse the number. For example, if the user enters 2765,
the function should reverse it so that it becomes 5672. The function should accept
the number as an input parameter and return the reverse number.

Page 7 of 8
19. Write a program that declares a function accepting two parameters. The first
parameter is a floating pointer number and the second parameter is an integer.
The program should multiply the floating-point number by itself the number of
times indicated by the integer. The function should return the result to the main
function. The main function should ask the user for the floating-point number and
integer. It should then call the function and store the result in a variable. Finally,
the main function should display the returned.

20. Write a program that inputs five integers in a one-dimensional array and passes
the array to a function. The function finds the minimum value in the array and
return to main function where it is displayed.

21. Write a function Change() that accepts an array of integers and its size as
parameters. It all array elements by 5 that are divisible by 5 and multiplies other
array elements by 2.

22. Write a program that inputs values in a 2-D array of 5 columns and 5 rows. It
displays these values using a function It passes the array to a function times2()
that doubles the values stored in all elements of array. The program then again
displays the changed values of the array using display() function.

Page 8 of 8

You might also like