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

CH#11 2nd Year Computer

This document appears to be a quiz or test covering programming control structures in C including selection statements like if/else and switch, and repetition statements like for loops and while loops. It contains 10 multiple choice questions, 11 short answer questions, and asks the student to write 3 programs - one using switch to check if a character is a vowel or consonant, one using if/else to check if a year is a leap year, and one using if/else to check if a number is even or odd. It provides spaces to record the student's name, roll number, marks obtained, and total marks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views

CH#11 2nd Year Computer

This document appears to be a quiz or test covering programming control structures in C including selection statements like if/else and switch, and repetition statements like for loops and while loops. It contains 10 multiple choice questions, 11 short answer questions, and asks the student to write 3 programs - one using switch to check if a character is a vowel or consonant, one using if/else to check if a year is a leap year, and one using if/else to check if a number is even or odd. It provides spaces to record the student's name, roll number, marks obtained, and total marks.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Name: Roll No: Obtained: Total:

Q1.Circle the correct option


1. Which programing structure executes program statements in order?
(a) Relation (b) Decision (c) Sequence (d) repetition
2. An expression that uses a relational operator is called:
(a) Operational (b) sequential (c) serial (d) relational
3. In If statement, false is repeated by:
(a) 1 (b) 2 (c) 3 (d) 0
4. An if statement inside the true block of another if statement is called:
(a) nested if statement (b) conditional operator (c) sentinel if statement (d) none
5. Which is an example of multiple branches from single expression?
(a) if statement (b) switch statement (c) while loop (d) all
6. Which of the following are valid case statement in switch?
(a) case x<4: (b) case 1: (c) case ‘ab’: (d) case 1.5:
7. The case block ends with:
(a) End select. (b) End case. (c) break; (d) case else.
8. Another term for conditional operator is:
(a) ternary (b) binary (b) byte (d) iteration
9.Which of the following is used for making two way decision:
(a) if (b) if-else (c) nested if (d) switch
10. if x = 8, y = 5, what will be the output of the following expression x>y? x*y : x+y;
(a) 5 (b) 8 (c) 3 (d) 40
Q# 02- Short Questions (2X10=20)
(1)Define control structure.
(2)What are three selection and three repletion statements?
(3)what is the use of “if-else” statement.
(4)Describe “switch” statement.
(5)Describe repletion structure.
(6)What happens if break is missed in case block?
(7)what is output of int price = 10; (8)Find the error in this code:
If(price != 10) void main(){
Price = 0; int a=10,b=12,c=24;
Else if(b%a==0)
Price += 2; Print f(“result=%d” ,b%a)
getch();}
(9)Write the alternative of if-else statement in C.
(10)Define for loop
(11)Write the types of loops
(12)Define Nested if
Q# 03- Long Questions (2X10=20)
1. Write a program that inputs a character and checks whether it is a wovel or consonant using switch statement. (unit
11)
2. Write a program that inputs a year and finds whether it is leap or not. Using if-else structure. (unit 11)
3. Write a program that inputs a number and tells whether it is even or odd using if-else structure. (unit 11)

Lecturer: Muhammad Ahmad Mian Email: [email protected]


Masters in Computer Science Cell: 03216687630

You might also like