0% found this document useful (0 votes)
207 views

Cs 116

This document contains a final exam paper for the Programming Fundamentals course CS116 from Sarhad University. The exam has 8 questions covering topics like operators, variables, expressions, control structures, arrays and more. Question 1 has multiple choice and true/false questions. The other questions require explaining concepts, writing programs, or differentiating between terms. The paper is out of 70 total marks and students must score at least 35 marks to pass.

Uploaded by

Ummay Aiman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views

Cs 116

This document contains a final exam paper for the Programming Fundamentals course CS116 from Sarhad University. The exam has 8 questions covering topics like operators, variables, expressions, control structures, arrays and more. Question 1 has multiple choice and true/false questions. The other questions require explaining concepts, writing programs, or differentiating between terms. The paper is out of 70 total marks and students must score at least 35 marks to pass.

Uploaded by

Ummay Aiman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Roll No.

__________________ 01 March, 2017

Sarhad University, Peshawar


(Distance Education)

Paper : Programming Fundamentals - CS116 Examination: Final, Fall - 2016


Time Allowed: 3 hours Total Marks: 70, Passing Marks (35)

NOTE: Question No.1 is Compulsory. Attempt ANY FOUR questions from the rest. All questions carry equal
marks. Mobile phones and other electronic gadgets are not allowed. Try to write in neat and legible
writing.

Q.1 (a) Fill in the blanks with appropriate choice. (10)


1. Variables and constants names cannot contain __________.
i. Number. ii. Underscore. iii. Period.
2. ________ happens when the result of a calculation exceeds the capacity of a data type.
i. System error. ii. Logical error. iii. Overflow error.
3. In _______ type of loop condition is tested after loop body.
i. For. ii. While. iii. Do-While.
4. Variables declared inside a function are called _______ .
i. Local variables. ii. Global variables. iii. Static variables.
5. Relational expression allows you to _________ constant values.
i. Compare. ii. Add. iii. Multiply.
6. In a C++ program, two variables in a function with _________ cannot be declared.
i. The same name. ii. The same type of data type. iii. Both of them.
7. In SWITCH statement, each case should be terminated by __________ statement.
i. DEFAULT. ii. CONTINUE. iii. BREAK.
8. __________ is a variable which can store the address of another variable.
i. Static. ii. Auto. iii. Pointer.
9. Putting semicolon (;) after condition in WHILE loop in C++ language, creates ______.
i. Finite Loop. ii. Infinite Loop. iii. Default loop..
10. ________ is a group of elements and all elements are of the same or of the different data types.
i. Structure. ii. Variable. iii. Array.

(b) Identify that which of the following statements are TRUE/FALSE. (4)
1. The character data type takes 8 bytes in the memory.
2. &&| is the symbol used for OR operator in C++ language.
3. It is necessary in C++ to declare a variable before its usage in the program.
4. Conditional operator is an alternative to IF-ELSE IF statement.

Q.2 (a) What is meant by operator, discuss the relational and logical operators in C++. (10)
(b) Differentiate between unary operator and binary operator. (4)

Q.3 Discuss the followings.


1. What is meant by variable initialization, explain with an example. (4)
2. What is meant by an expression, explain arithmetic expression. (5)
3. What is meant by a relational expression, explain with an example. (5)

Programming Fundamentals - CS116-Fall - 2016 Page 1 of 2


Roll No.__________________ 01 March, 2017

Q.4 (a) Describe the IF statement in C++ in detail along with flowchart representation. (8)
(b) Write a program in C++ that input salary, bonus and grade. It adds 50% bonus to the salary if the
grade is greater than 15. It adds 25% bonus to the salary if the grade is 15 or less and then
display the total salary in both cases. (6)

Q.5 (a) Write a program in C++ that takes a number as input from the user and displays
whether it is divisible by 5 or not using IF-ELSE statement. (6)
(b) Write a program in C++ that take an integer "n" as input from the user and calculate
sum using the following formula of the integers from 1 to "n" using WHILE loop. "n"
will be a positive value entered by the user. (8)
(i.e., sum = ((1 + 2 + 3 + ---- + n)/n)

Q.6 (a) What is meant by repetitive control structure, discuss the working of FOR loop in
C++ with flowchart representation. (10)
(b) Write a program in C++ that inputs two numbers form the user and displays the result of the
first number raise to the power of the second number using WHILE loop. (4)

Q.7 (a) What is meant by arrays in C++, explain the usage of one-dimensional array in C++ with the help of a
C++ program. (10)
(b) Differentiate between the local variables and global variables. (4)

Q.8 Write short notes on any TWO of the followings. ( 7, 7 )


1. Structures in C++.
2. SWITCH statement in C++.
3. BREAK statement in C++.

Programming Fundamentals - CS116-Fall - 2016 Page 2 of 2

You might also like