Cs Paper 2nd Year
Cs Paper 2nd Year
SECTION 1
Q1 (Objective Type) Choose the correct option out of A,B,C and D 10 Marks
1. a+=b is equivalent to (A) a=a+b (B) b+=a (C) b=b+a (D) a=+b
2. How many bytes of memory use by 'char' data type in C (A)1 (B) 2 (C) 3 (D) 4
3. Which of the following operator determines the address of a variable (A) &(B) % (C) \ (D) #
4. The = operator in C is called as (A)Equal(B) Assignment (C) Negation (D) Result
5. Which of the following an illegal variable name (A)_number(B) 2digit (C) jan2019 (D) illegal
6. In C Relational operators allow you to (A)Add (B) Compare (C) Repeat (D) Iterate
7. Which of the following is ternary operator (A)? (B) ++ (C) % (D) &&
8. Which escape sequence is used for backslash (A)\(B) / (C) \\ (D) \b
9. The process converting source code into object code is called
Debugging (B) Compilation (C) Linking (D) Loading
10. If a=15 and b=10 what will be the output of following expression a>b?a-b:a+b;
(A)15 (B) 25 (C) 50 (D) 5
SECTION 2
Q2 (Short Questions) Answer any 10 out of the following questions 20 Marks
1. How variables are declared in C give two examples 2. How arithmetic overflow occurs
3.Differentiate between source code and object code 4. Why we use default label in switch statement
5. Determine output of the following code: 6. Determine output of the following code:
int a=15; int b=10; float a=15.30; float b=9.8;
printf("%d\n%d",a%b,a+b); b+=a; printf("%f",b);
7. Determine output of the following code: 8. Determine output
float a=15.3456; int a=4;
printf("%3f",a); a=a%3;
printf("%d",a+1);
9. Find error in the 10. Determine output of 11. Differentiate between printf and scanf
code the following code: functions
void Main() if(7%3==0) 12. Write syntax for if-else if-else statement
{ { printf("Punjab");}
Int x=10 else{ printf("Sindh");} 13. What is purpose of include directive
x+4=x;}
SECTION 3
Q3: Attempt Any One Question 10 Marks
Write a program code in C that accepts two numbers from user and check if both
numbers are equal then display "America" otherwise display "China" on screen. OR
Write a program code in C that accepts a character from user and checks whether it's a
vowel or not.
Q4: Attempt Any One Question 10 Marks
How many types of operators are in C. Discuss briefly OR
Explain switch statement. write its syntax and draw its flow chart diagram