Sie sind auf Seite 1von 1

Monday, April 09, 2018

SCIENCE ACADEMY SADDAR GOGERA OKARA


Revision Test - 2nd Year

Name: _______________________ Test: (Com-Science 2nd Year)


Time: (2:30 Hr) Total Marks: (45)

|| CH-11 Decision Constructs”) ||

Q-No 1: Define any 8 Questions from Following… (16) Q-No 3: Define any 3 Questions from Following… (25)
Definitions / Output: Programming With Construction With Decisions:

Write any two programs using If-Else Statement.


1. What is Control Structure? Write the names of its types?
2. Define Repetition?
1. Write a program that input a number from and
3. Define Selection Structure?
4. What is If Condition? Write its syntax. find number is Even or Odd, Using if-else
5. Define Limitation of simple “if” Statement? Structure.
6. Define Nested-If Statement with syntax? 2. Write a program that input two number and
7. What is Nested if-else Statement? find it is Equal or Not, Using if-else Structure.
8. Write the Working of Switch Statement? 3. Write a program that input a year and find
9. What is Conditional Operator? year is Leap or Not, Using if-else Structure.
10.What is Switch Statement?

Q-No 2: Trace Output… (4) Write any one program using If-Else Statement.
int a , b; int a=4, b=2, c=5; 1. Write a program that input number from user
a=1; if(a>b) and determines whether it is Positive,
b=5; if(c==a) Negative or Zero, Using if-else-if Structure.
if(a+b < 6) a=6; 2. Write a program that input marks from user
printf(“Value is True”); else and tells the Grades of the Student or Pass /
else a=7; Fail Using if-else-if Structure.
printf(“Value is False”); printf(“%d” , a);
Write the following programs.
Ans: Ans:
1. Write a program that input a character and
displays whether it is Vowel or Not
int j,k,l; int p , q , r; 2. Write a program to display the names of
j=40; p = 10; the days of the week Using Switch Structure.
k=30; q = 3;
l = 15; if(p % q ==3) (OR)
if (j + k) < 60 && ( l < k – 20) r =0;
printf(“ %d” , L); else Explain two Statement from Followings:-
i. If-else-statement with Flowchart.
else r=1;
ii. if-else-if statement with Flowchart.
printf(“ %d” , j); printf(“%d” , r):
iii. Switch Statement with Flowchart.
Ans: Ans:

Engr.Naveed Ahmed
info.engrnaveed@gmail.com BS (CS) / MSc (Comp) D.I.T.
UNIQUE SCIENCE ACADEMY SADDAR GOGERA OKARA

Das könnte Ihnen auch gefallen