Anda di halaman 1dari 4

Class XI Subject Computer Science Code No.

o. 083 Time allowed: 3 hours Instructions: (i) All questions are compulsory. (ii) Programming language: C++ 1. a. Explain the need of Operating System. b. Name any two Utility Softwares. c. Convert the following : i. (213)10=( ?)2 ii. (1100.01)2= ( ?)8 iii. (AF)16 = (? ) 2 iv. (56)10 = (? )8 d. What is the need for Cache memory ? e. Which technology is used for sending information through wireless devices ? f. 1 TB = _____ KB = _____Bytes 2. a. b. c. d. e. What is debugging ? 1 What is the difference between finite and infinite loop? 1 What do you understand by modularity ? 1 Give the difference between source code and object code. 1 What are the differences between an entry controlled loop and an exit controlled loop ? 2 f. Arrange in order:1 i. Coding of the program ii. Design the program iii. Testing the program iv. Analyze the problem v. Understand the problem g. Differentiate between syntax and logical errors. Give examples. 2 h. Differentiate between /**/ and // 1 3. a. Name the header files to which the following functions belong. i. strcat( ) ii. clrscr() iii. atoi() iv. isupper() b. What are preprocessor directives ? Explain with example. c. Give output of the following program segments : i. a=5; cout<<(a = = 8); ii. int a = 10; a >10 ? cout << a : cout<< a; int x; iii. char ch = A; x = ch; cout << x; 2 2 1 4 Maximum Marks: 70

1 1 1

2 3

d. Consider the following program code: 2 int R=25000; int S=2*R; cout<<S<< <<R; The above program does not give the desired output. Give reason. Also give the correct statement. e. How a is different from a? 1 f. Identify the correct identifiers(any 2):1 (i). AS_G_D (ii) 2wer (iii) roll number (iv) S.I. (v) age123 (vi) rate g. How many bytes of memory is allocated to a and b, if a and b are declared as below: 1 int a; long b; h. Solve the following: 2 i) 8 / 2 + 9 * 10 % 2 ii) a && b || a <= b if a = 10, b = 5 i. Variables a , b are integers and c is a float. If a is 15 and b is 4 then what can be done to get the result of a / b as a decimal and store the result in c. Write the appropriate statement. 1 4. a. Write a function to accept no. of calls made by user and calculate the mobile call bill as per the following criteria: 3 No. of Calls 0-50 51-100 101- 200 201 and above Amount Free 20p per call 50 p per call 75p per call

Rent will be Rs 100 and is compulsory. b. Give the output of the following program segment: char fname[50]= Charlie; char lname[50 ]= Tango; for (int i=0; i<strlen(lname)-2;++i) lname[i] = toupper( lname[i]); puts(lname); cout<<endl; strcat(lname, ); strcat(lname,fname); cout<<lname<< <<fname; c. Consider the following program code. Select the expected output from the options(i) to (iv) # include <iostream.h> # include <stdlib.h> void main( ) { randomize(); int dice = 6, res; res = random(dice) + 1; for (int i = 1 ; i<res ; ++i) cout << I << ; }

(i ) 0 1 2 3 4 (iii) 2 3 4

ii) 1 2 3 4 5 iv) 0 1 2

Also justify your answer. d. Write a function that takes a long type variable as parameter and returns the sum of its digits. 3
Example 5. Input : 3264 Output : Sum is 15 2

a. Give the output of the following program:


# include <iostream.h> int x=10; void increase(int a,int &b, int c) { ++a; b++; ++c; Cout << a << \t << b << \t << c; } void main() { int x = 5,y = 10; increase(x, y, ::x); cout<<\n<<::x<<\t<<x<<\t<<y }

b. Write a function count() that takes array - list, its size and an integer number as parameter and returns the numbers of times n appears in the list. 4
Example : Input : Array is 3 4 6 12 6 7 5 2 6 n is 6 Output : 3

c. Write a function in C++ to print the sum of left diagonal elements and right diagonal elements of 3 x 3 matrix. 3
Example Input : Array is 3 4 6 1 5 7 2 4 8 Output : Sum of left diagonal elements is 16

6. a. Illustrate the use of typedef with an example. 2 b. Rewrite the following program after correcting the error(s), if any. Also underline the corrections made. 2
# include<iostream.h> # include<string.h> int main( ) { int vehicleno, vehiclename[30],nowheels=0; cin>>vehicleno; gets(vehiclename); if (vehiclename= Car) nowheels=+4; }

c. Rewrite the following code using switch case statements


char ch ;

int x,y,z; cin>>ch>>x>>y; if (ch= =+) z=x+y; else if (ch= = -) z = x- y; else if (ch = = *) z = x * y; else cout<<Invalid Operator;

d. Rewrite the following using while loop


int n=15, sume=0; for( int i=1; i<=n; i++) { if( i % 2 == 0 ) sume + = i ; } 7.

a. What will be the output of the following code:struct Grocery { int I_no; char I_name[20]; float I_price; int I_qty; }; void main() { Grocery S[4]={{1,Bread,11.0,20}, {2, Butter,25.0,40}, {3,Cream,65,15}, {4,Jam,95.5,20}}; cout<<S[0].I_no; cout<<S[1].I_name[3]; cout<<S[2].I_qty; cout<<S[3].I_name; }

b. Declare a structure Student with the following elements:

Rollno integer type Name string type DOB date type Marks An array of float type to store marks in 5 subjects Average float Write following user defined function in c++ to implement the above structure : 1 A function Read_student() which takes a structure object as a reference parameter and accept values of Rollno, Name, DOB,Marks array 2. A function Calculate_Avg() which takes a structure object as a parameter and calculates the average marks of the student

Anda mungkin juga menyukai