📘 Access 10,000+ CBC Exams With Marking Schemes

Prepare your learners for success! Get CBC-aligned exams for Grades 1–9, PP1–PP2, Playgroup and High School - all with marking schemes.

Browse Exams

Instant download • Trusted by 100,000+ teachers • Updated weekly

Procedural Programming Question Paper

Procedural Programming 

Course:Bachelor Of Science (Mathematics & Computer Science)

Institution: Karatina University question papers

Exam Year:2012



1. What is the difference between x = 3 and x == 3?
2. Are negative numbers true or false?
3. What does the "conditional expression operator" do?
4. What does if(x) and if(!x) mean?
5. Rewrite the following line by using the if ... else statement.
y = (x > 2 && x<=9) ? x*x:1.0/x;
6. What is wrong with the following code?
if( x > y > z ) cout << x*y*z << endl;
7. What is the output of the following program?
#include <iostream>
int main(){
int z, x = 11, y = 221;

if(y) z = y < x ? x/y : y/x;
else z = 0.0;

std::cout << "z = " << z << std::endl;

return 0;
}
8.What is the output of the following program?
#include <iostream>
int main()
{
int a = 1, b = 1, c;

if (c = (a-b)) std::cout << "The value of c is: " << c;
else
std::cout << "The value of c is: " << c;
return 0;
}
9.What is the output of the following program?
#include <iostream>
int main()
{
int a = 5, b = 7, c;

if ( (c = a + b) != 35 )
std::cout << "The value of c is: " << c;
else
std::cout << "The value of c is: " << c;

return 0;
}

10.Write a program to input an integer number and output whether it is even or not.

11.Write a program that reads a year from the keyboard and outputs whether it is leap year or not.

12.Write a program that reads a grade A, B, C, D, or F and then prints "excellent", "good", "fair", "poor", or "failure". Use else if.

13. Write a program for the question(12) using switch statement.






More Question Papers


Exams With Marking Schemes

End Term 3 Exams

Mid Term Exams

End Term 1 Exams

Opener Exams

Full Set Exams



Return to Question Papers