Home /University Of Sargodha (UOS) /Programming Fundamentals

Programming Fundamentals BS 1 Semester/Term University Of Sargodha (UOS) 2022

Programming Fundamentals BS 1 Semester/Term University Of Sargodha (UOS) 2022 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

More Programming Fundamentals papers

See all

Paper text

University of Sargodha

BS 1" Term Examination 2022

Subject: CS/IT/SE.

Time Allowed: 02:30 Hours

Paper: Programming Fundamentals (CMPC-101)

Maximum Marks: 40

Note:

30226

ustapni.com

Objective part is compulsory. Attempt any three questions from subjective part.

Objective Part

(Compulsory)

Write short answers of the following in 2-3 fines each on your answer sheet.

(2*8)

Write the name of two high priority logical operators.

Write name of right associative operator.

Evaluate the expression 15 + 7 - 8 * 4/ 9% 3 - 2;

Write a statement in C language that shows explicit type casting.

Consider following declaration statement.

int

*ptr, var = 20;

ustadni.com

Is following statements valid? Give reasoning.

pir - var;

Vi.

ViL,

What is scope and life time of a static variable?

Considering following declaration.

int * ptr;

float var = 5 :

Is following statement true/flase? Give reason;

pir = & var;

vil.

What is the output?

int p = 1;

for (int i = 6; i>= 2; i = i -

2)

p*= i;

printf"%din", p);

03.

Q.3.

Q.4.

Q.5.

Q.6.

Subjective

rt

(3*8)

Write a program that accepts 10 integer values from user in an array and passes the array and its

size to a function. The function counts the number of even values within the array and returns to

main where the result is displayed.

Write a program that declares a structure employee with data members name (array of characters)

and salary (float). Create three variables of employee, accept values from keyboard and display

name of the employees having salary more than average salary of the given employees.

Write a program that accepts a +ve integer value in main function and passes the number to a

function that calculates the factorial of the number. The main) displays the factorial. (Use while

loop to calculate the factorial)

Write a program that accepts two float values from user and pass their pointers to a function. The

function swaps their values within the function. The swapped values are displayed by main.

Write a program that accepts a string from user and pass it to a user-defined function named

counter. The function counts the occurrence of character 'M' within the string. The result is

displayed by main(.

ustadni.co

.. LK-6110-

Scanned with CamScanne

ustaonI con