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

ComputerScience II C Optional

The document contains a model question paper for the H.S.C. Annual Examinations 2021 Computer Science Paper-II Programming Using 'C' exam. It includes 36 multiple choice questions in Section A and 5 short answer questions in Section B worth a total of 75 marks. The multiple choice questions cover topics related to C language fundamentals, operators, data types, functions, loops, arrays, and more. The short answer questions ask about integrated development environments, include and header files, valid and invalid identifiers, and the difference between call by value and call by reference.

Uploaded by

Mawiz Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

ComputerScience II C Optional

The document contains a model question paper for the H.S.C. Annual Examinations 2021 Computer Science Paper-II Programming Using 'C' exam. It includes 36 multiple choice questions in Section A and 5 short answer questions in Section B worth a total of 75 marks. The multiple choice questions cover topics related to C language fundamentals, operators, data types, functions, loops, arrays, and more. The short answer questions ask about integrated development environments, include and header files, valid and invalid identifiers, and the difference between call by value and call by reference.

Uploaded by

Mawiz Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

BOARD OF INTERMEDIATE EDUCATION, KARACHI

H.S.C. Annual Examinations 2021

(MODEL QUESTION PAPER)


NOTE: This paper comprises Two independent options – (I) Programming Using „C‟ and (II) Programming Using
Visual Basic. The candidates have to attempt any One Option, Programming Using „C‟ OR Programming
Using Visual Basic, whichsoever they have offered.

COMPUTER SCIENCE PAPER-II


PROGRAMMING USING „C‟
(OPTION-I)

Total Duration: 02 Hours


Total Marks: 75 SECTION "A" (M.C.Qs) Marks: 36

Note:- Answer All Questions from this section or Compulsory

1. i) C language developed by
 Peter Norton  Floyd
 Catherine Ricardo  Dennis Ritchie

ii) printf() function prints:

 character  string
 any number  all of them

iii) The library function sqrt( ) , return the square root of x = 1024

 512  256
 32  64

iv) The include <conio.h> is not begin without a sign of


 $  !=
 #  @

v) A character constant is a single character, enclosed in

 double quotation mark  single quotation mark


 Left and right braces  left and right parenthesis

vi) Comments or remarks can be placed anywhere within a program as long as they are placed
within Delimiters.

 by braces and asterisks { * comments * }


 by asterisks * comments *
 by parenthesis and asterisks ( * comments * )
 by slashes and asterisks /* comments * /
vii) Which instructions are correct to declare the types of variables example.

 int k; float m; char n;


 t integer; h:float; s char;
 hint; a float; m character;
 int t; float c; chr h;

viii) In c language of this expression y= 5+3-6*2/3, what will be the arithmetic operation by:
 Precedence (i) 5+3 (ii) 3-6 (iii) 6*2 (iv) 2/3
 Precedence (i) 6*2 (ii) 2/3 (iii) 5+3 (iv) 3-6
 Precedence (i) 2/3 (ii) 6*2 (iii) 5+3 (iv) 3-6
 Precedence (i) 3-6 (ii) 5+3 (iii) 2/3 (iv) 6*2

ix) Every statement in C/C++ program should end with

 full stop (.)  Comma (,)


 Semicolon (;)  colon (:)

x) Which one is escape sequence?

 “/n”  “\t”
 “ %f ”  i++

xi) The gets( ) and puts( ) functions offer simple alternatives to use of

 scanf( ) and printf( )  sqrt( ) and pow(a,n)


 abs() and ceil( )  exp( ), toascii( )

xii) What will be the output of this solving 4 % 7

 (0) Zero  (1) One


 (4) four  (5) Five.

xiii) These operators are referred to as logical


 <=,>=  &&, ||
 + =, =  /, %

xiv) A relational operator (>= )

 combine values  distinguish different type of variables


 Compare values  distribute values

xv) Pick the odd one out

 a=a+1  a+=1
 a=+1  a++
xvi) The function void game1(void); is the example of

 Calling function  A Prototype declare a function


 Return type function  Itself function

xvii) The directives for the preprocessors begin with

 Ampersand symbol (&)  Two Slashes (//)


 Number Sign (#)  Less than symbol (<)

xviii) There is a unique function in C/C++ program by where all C/C++ programs start their execution

 start( )  begin( )
 main( )  output( )

xix) To increase the value of c by one which of the following statement is wrong?

 c++;  c = c + 1;
 c + 1 => c;  c += 1

xx) Which one of the following is valid expression in C/C++ language.

 x=2 + 3*(b - 5);  x= c = 5;


 x= 11+3%  x=(a + b)(c+b)

xxi) When following piece of code is executed, what happens?

x = 3;
y = x++;
printf(“x=%d and y=%d”,x,y);

 x=3 and y=4  x=4 and y=4


 X=4 and y=3  x=3 and y=3

xxii) Which is not a loop structure in C/C++?

 do while( )  while( )
 repeat – until ( )  for( )

xxiii) Name the loop that executes at least once.

 for( )  do-while( )
 while( )  goto - loop

xxiv) The function add( ); is the example of

 Calling function  A Prototype declare a function


 Return type function  Itself function
xxv) What is right way to Initialize an array?

 int x[6] = {2,3,4,12,5,4}  int x{ } = {2,3,4,12,5,4}


 int x{6} = {2,3,4,12,5,4}  int x(6) = {2,3,4,12,5,4}

xxvi) Array elements are always stored in __________ memory.

 Random  Sequential
 Sequential and Random  sequentially gap

xxvii) Which loop is unconditional loop?

 for( )  while( )
 goto – label_name  do – while

xxviii) What will be printed after execution of the following code?

void main(void)
{
Int arr[10] = {1,2,3,4,5};
printf(“%d”,arr[5]);
}

 Zero (0)  5
 6  10

xxix) Which statement is correct about Passing by value parameters?


 It cannot change the actual parameter value.
 It can change the actual parameter value.
 Parameters is always in read-write mode
 call function

xxx) Which of the following is a logical NOT operator?

 !  &&
 &  &#

xxxi) Which statement can print \n on the screen?

 printf("\\n");  printf("n\");
 printf("n");  printf('\n');

xxxii) Which of the following cannot be checked in a switch – case statement?

 character  int number


 float number  None

xxxiii) The keyword used to transfer control from a function back to the calling function is

 switch  goto
 go back  return
xxxiv) How many choices are possible when using a single if-else statement?

 1  2
 3  4

xxxv) Evaluate, which is TRUE each of the following expressions:

 (4 <= 5 &&7 > 4)  (3!= 3 || 9 <= 6)


 (8>=9 &&2<3 )  6!=3*2

xxxvi) The continue statement cannot be used with


 for( )  while( )
 do-while( )  switch ( )

SECTION-B (SHORT ANSWER QUESTIONS) (25 Marks)

NOTE:-Attempt Five question from this section( No Answer Should exceed 6-7 lines).

2. i) What is an IDE? Which two short-keys are used to compile the program?
ii) Define include and header files.
iii) Determine which of the following are valid or invalid identifier, integer constant, character constant,
float (real), constant, string constant and separate them. If invalid give reason?

(a) record1 (b) $tax (c) name and address (d) 27,822
(e) 0.576 (f) 1527 (g) 2e-8 (h) 1,232.5 (i) 5.234

(j)„a‟ (k) “Pak”

iv) What is the difference between Escape sequences and format specifiers?
v) Write a Program in „C‟ language to use all arithmetic assignment operators.
vi) Name the five basic data types of C-language? Write typical memory requirements and data types
range?

vii) What will be the output of the following program segment?

int a=2,b=2;
if(a!=0)
b=0;
else
b*=10;
printf("%d",b);
viii) What are Local and Global Variables also write both examples?
ix) Write the Syntax of Function definition, calling Function and Prototype Function in C.
x) Define an array. How to declare Array in C? Give two examples.

SECTION-C DETAILS ANSWERS QUESTIONS(14 Marks)

Note:-Attempt any Two Questions from this section

3. What are programming languages? Explain its errors types?

4. How many types are Loops in C-programming language? Show syntax of each loop?

5. Write a „C‟ program to generate the following shape?


666666
55555
4444
333
22
1

OR
Write C Program to arrange any ten numbers in ascending order by using an array.

6. Convert the following program segment of if-else statement into Switch – Case Statement.

Scanf(“%d”,&condition);
if(condition==1)
printf(“ Red colour”);
else if(condition==2)
printf(“ Black Colour”);
else if(condition==3)
printf(“ White Colour”);
else
printf(“ No Colour”)

You might also like