You are on page 1of 26

Set I Sample Paper Class XI Subject – Computer Science

Time: 3Hours Maximum Marks: 70
Note. (i) All questions are compulsory.

1 a) What are the different functions of operating system? b) How the information can be used as a data explain ? c)What do you mean by unary operators d) What are the different parts of CPU? Explain every part in brief. e) Define System Software and what are its two main types? Give examples.2 f) What is Booting? g) Which of the following are hardware and software? (i) Capacitor (ii) Internet Explorer (iii) Hard disk (iv) UNIX 2. Explain the following term: (Give answer any six) i) Variable ii) Token iii) Array iv) Debugging v) Comment vi) Keyword 3 a) What is the difference b/w “while” & “do while” loop? b) What are data types? What are all predefined data types in c++? c) What will be the size of following constants? ‘\v’,”\v”, d) Write the corresponding C++ expressions for the following mathematical expressions: 1 i) √ (a2+b2) (ii) (a+b)/(p+q) 2 e) Evaluate the following, where p, q are integers and r, f are floating point numbers. The value of p=8, q=4 and r=2.5 (i) f = p * q + p/q (ii) r = p+q + p % q 4 a) What is the output of the following? i) # include<iostream.h> void main ( ) { int i=0; cout<<i++<<” ”<<i++<<” ”<<i++<<endl; cout<<++i<<” ”<<++i<<” ”<<++i<<endl ii) } # include<iostream.h> void main( ) { a=3; a=a+1; if (a>5) cout<<a; else cout<<(a+5);

2 2 2 2 1 1 6

2 2 1

2 2

Page 1 of 26

} iii) What will be the output of the following program segment? If input is as: (a) g (b) b (c) e (d) p cin >>ch; switch (ch) { case ‘g’: cout<<”Good”; case ‘b’: cout<<”Bad”; break; case ‘e’: cout<<” excellent ”; break; default: cout<<” wrong choice”; } iv) Determine the output:

2 3

2 for(i=20;i<=100;i+=10) { j=i/2; cout<<j<<””; } v) What output will be the following code fragment produce? void main( ) { int val, res, n=1000; cin>>val; res = n+val >1750 ? 400:200; cout<<res; } (i) if val=2000 (ii) if val=1000(iii) if val=500


5 a) Find the error from the following code segment and rewrite the corrected code underlining the correction made. 2 # include(iostream.h) void main ( ) int X,Y; cin>>>X; for(Y=0,Y<10, Y++) if X= =Y cout<<Y+X; else cout>>Y; } b) Convert the following code segment into switch case construct. int ch; cin>>ch; If(ch = = 1) { cout<<“ Laptop”; } else If(ch = = 2) { cout<<“Desktop ”; } else if(ch= = 3)


Page 2 of 26

} else { cout<<“Invalid Choice”. } d) Given the following code fragment int ch=5. #include<iostream. 2 4 4 4 2 Page 3 of 26 .++i) cout<<”\n”<<i. c) Write a C++ program to calculate the factorial of any given number d) Write a C++ program to print the Fibonacci series e) Write a C++ program to print table a given number. for(i=1. b) Write a C++ program to check a number for Armstrong or not.{ cout<<“Notebook”. cout << ++ch<< “\n”<<ch<<”\n”. i) ii) What output does the above code fragment produce? What is the effect of replacing ++ ch with ch+1? 2 2 4 3 6 a) Which header files are required for the following? (i) frexp()( (ii) sqrt( ) (iii) rand( ) (iv) isupper() b) Evaluate: i) (12)10 = ( X)2 ii) (347)8= (X)10 iii) (896)16= (X)8 iv) (100)10= (X)2 7 a) Write a C++ program to check a year for leap year or not.i<=20.h> void main() { int i. } } } c) Convert the following code segment into do-while loop.

25. one byte d. Major OS functions are listed below 1. Keywords are the reserved words. MU(memory unit) e. i. 0 1 2 4 5 6 .No. variable is a name given to the memory location.good & bad/ for b – bad / for e – excellent / for – p wrong choice iv.Answer key Q. There are two types of unary operatorsi. i. 200 Q. The keyword can not be taken as a name of variable. 400. vi. iii. Case 2: cout<<“Desktop ”. CU(control unit).35. unary operators are the operators. cin>>ch. While do-while loop is exit control loop and even the condition is not true at least one time the body of the loop will be executed. Page 4 of 26 . break.20. whose value can be changed during run time. While loop is entry control loop i.5 a. int ch. Unary decrement (a—(post decrement)/--a(pre decrement)) d.15. a++(post increment))/++a(pre increment)) ii.4 a. while loop first will test the condition and if condition is true then only the body of the loop will be executed.break.40. For g. Case 3: cout<<“Notebook”.if(x==y)) & cout>>y(correct cout<<y) b. having one operand and two operators.2 i.No.50 v. Q. 10. 9 . c.30. int . Process Management 2.I&III. The smallest individual unit in a program is known as a token iii. unary increment ( Ex. students do yourself Q.No. sqrt(a*a+b*b) & ii. switch(ch) { Case 1 : cout<<“ Laptop”.45. Software. used to give the information about the code for future use.totoal no. System software are the software that govern the operation of computer system and make the hardware run. These software can be classified into two categories. Hardware. The processed information can be used as a data again to produce a next level information.1 a. Default : cout<<“Invalid Choice”.e. Operating System & Language Processor f.II&IV Q.char. ((a+b)/((p+q)*(p+q)) e.3 a. ALU(Arithmetic logic unit). For example. The fundamental data types are. Array is a combination of similar data values. 400. float . ii. Storage Management 3.No. debugging is a way to correct the errors in the program during compilation v. Errors – if x==y (correct. double and void . break. comments are non executable statements. of students school wise can give the information that how students are there in one region again this information as a data ca be used to calculate that how many students are studying in KVS c. Information Management (Student has to describe all in brief) b. b. data types are means to identify the types of data and associated operation of handling it. It is used to store more than one value under same name iv. ii. programed by the programmer to perform the specific task.No. Booting is a process through which operating system makes the computer system ready to perform user’s task g.

cout<<endl<<"Enter any number to check". getch(). } else if(year%4==0) cout<<"\nLeap Year". while(Temp>0) { P=Temp%10.Temp.h .No.h> void main() { int Number. In both condition output will be 6 5 Q.7 a. int year. (4226). } b.No. stdlib.h> #include<conio. #include<iostream. math. ++i }while (i<=20). int P.b=0.} c. Temp=Temp/10. b=b P*P*P. #include<iostream. cin>>Number. Temp=Number. if(year%100==0) { if(year%400==0) cout<<"\nLeap Year". 1100. } Page 5 of 26 . math.h> void main() { clrscr(). (232) . } d.h .h> #include<conio.6 a. i=1 do { cout<<”\n”<<i.h b.h> void main() { int i. #include<iostream. else cout<<"\nNot a Leap Year". cout<<"Enter Year(ex:1900):". (1100100) Q. cin>>year. ctype.h .

cin >> number.h> int factorial(int).n.second. int i.third. for(i=2. else cout << number << " factorial is: " << factorial(number) << endl. } c. second=1.1). #include <iostream. if (number < 1) cout << "That is not a positive integer. } else { cout<<"Not an armstrong no". else return number * factorial(number .\n".i<n. } getch().if(b==Number) { Cout<<endl<<"Armstrong no". cout<<"fibonacci series\n". first=0. cin>>n. first=second. unsigned long first.} Page 6 of 26 . } return 0. cout<<first<<" "<<second. Second=third.i++) { third=first+second.h> int main() { clrscr(). #include<iostream. void main(void) { int number. } d. getch(). } int factorial(int number) { if(number <= 1) return 1. cout<<" "<<third. cout<<"how many elements(>5)? \n".h> #include<conio. cout << "Please enter a positive integer: ".

cin>>m. cout<<"Enter the number to generate its table". cout<<"Enter the number(table upto)".i. } } Page 7 of 26 . while(i<=m) { r=n*i.h> #include<stdio. cout<<N<<"*"<<I<<"="<<R<<endl.m.h> void main() { int r. i=1.e.n. cin>>n. #include<iostream.

h> and #include”iostream.h” 2 Q3) a) Classify the following variable names of c++ into valid and invalid category (i) 1no (ii) num 1 (iii) num (iv) num1num (v) num+1 (vi) num. void check(). { int m=10*::m. cout<<"m="<<m<<"::m="<<::m<<endl.h> int m=5. } 2 3 Page 8 of 26 .Set II Sample Paper Class XI Subject – Computer Science Max Marks 70 Note:. } check().1 b) Give output of following code. c) What is an Operating System? Explain its any two functions d) How is a compiler different from interpreter? e) Convert (i) ( 10.1110)2 =( ? )10 Q2) a) What do you mean by run time error? b) what is the deference between if and if – else statement c) Mention and explain briefly any three characteristics of a good program d) How can you give a single line and multiline comments in C++ explain with suitable examples 2 1 2 2 2 e) what do you mean by header files? What is the difference between #include <iostream.All questions are compulsory Q1) a) What is significance of My Computer Duration 3 hrs ? 2 1 2 2 b) Explain different types of operating systems . #include<iostream. check(). } void check() { ++m. cout<<"::m="<<::m<<"m="<<m<<endl. cout<<"m="<<m<<"::m="<<::m<<endl. void main( ) { int m=20.10)10= ( ? )2 (ii) (101011.

2 2 2 2 c) Find syntax error(s) if any in following program ( Assume all header files are present) 2 main<> { int c. puts(name). case 1.5: { cout<<” India is great\n”. ‘case’ 2: { cout<<” hello\n”. void main( ) { char name[40]. cout<<”done \n”. while(x<=100) { cout<<” the value of x is \n”<<x. switch( c ). strcpy(name. } break. b=5 initially (i) ++a<=5 (ii) b++<=5 2 d)Name the header file(s) that shall be needed for successful compilation of the following C++ code. } f ) Define token ? g) What is the difference between call by value and call by reference explain with suitable example h)Find the output of the following program. } e) Explain conditional operator (?) with example in c++ .c) What will be result of following statements if a=5 .”India”). x+=2. } // end of main } // end of switch d) How will you declare and define i)Array named mark with 10 integer values ii)array named avg with 8 float values e) Convert following while loop to for loop int x=0. f) What is difference between ‘/’ and ‘%’ operators in c++ ? explain with a example 2 Q4) a) What do you mean by function prototype in C++ b) Explain Break and Continue statement in C++ with example. } break. 3 1 2 1 2 Page 9 of 26 .

else Text[I] = Text[I+1]. c) Write a program to find the total number of characters. } cout<<Text.h> #include<ctype. Q5 : a) Write a program to print the left and right diagonal element of an NXN matrix b) b.#include<iostream. } i) What are differences between for and do. Page 10 of 26 .I++) { if(!isalpha(Text[I])) Text[I]=’*’. give a code to illustrate both. Avoid duplication of elements. lines and words in a paragraph of text.h> void main( ) { char Text[ ] = “Comp@uter!”. d) Write a program to sort an array on N numbers in ascending order. e) Write a program to find the roots of a quadratic equation. Text[I]!=’\0’. for(int I=0. Write a program to find the factorial of a number recursive function. else if(isupper(Text[I])) Text[I]=Text[I]+1.while loop ? explain with example suitable C++ 2 4 4 4 4 4 2 j) How can you define Global Variable and Local Variable? Also.

i. if statement can perform only true condition and there is no option for false condition while if-else statement can perform both true as well as false condition . Note. for example.No.// Example./* this is the way To give multiline Comment */ e.// expre_Expressions_with_the_Conditional_Operator.No. iv are valid declaration b. Interactive c. d. Single User ii. the second operand is evaluated.h e. i . For example any number is divided by zero (c=a/0) is run time error b. It is evaluated and all side effects are completed before continuing.// Program to find the sum of two numbers And Multi line comment – which can be given by using the symbol /*…………. String.No. the third operand is evaluated. Documents and data files. if(a<b) cout<<” a is greater than b” – in this code for false condition no statement is given if(a<b) cout<<” a is greater than b” else cout<<” b is greater than a” – here for both option either true or false output will come c. Real Time v. The conditional operator works as follows: • • • The first operand is implicitly converted to bool. Comments in c++ can be given in two way Single line comment – which can be given by using the symbol . Time Sharing iv.3 a. Q.cpp Page 11 of 26 .2 a. Functions. True and false d. Types of operating system i. Also the things we have on our computer – Your Programs.are all accessible from form one place called My Computer. b. If the header file is written in angular bracket(<>) compiler will search it in C++ library only while in case of “ ” the header file will be searched throughout the database. m=5 ::m=5 m=20 ::m=6 m=7 ::m=20 c. An interpreter converts source program(HLL) into object program(LLL) line by line whereas compiler converts source program into object program in one go and once the program is error free it can be executed later . My Computer is used to viewing the contents of a single folder or drive. Multiprocessing vi. The conditional operator (? :) is a ternary operator (it takes three operands). Header files are the files in which some pre – programed program will be stored by the developer of the language which will help the user of to develop their program. The result of the conditional operator is the result of whichever operand is evaluated — the second or the third. Students has to explain both in brief d. An operating system is a program which acts as an interface between a user and the Hardware.h and stdio. If the first operand evaluates to true (1). Multiuser iii. Q. Process Management and Storage(Memory) Management.. vi – are invalid & iii.*/ Example -.Answer Key Q. ii . Example. An error in logic or arithmetic that must be detected at run time is called run time error.1 a. If the first operand evaluates to false (0).v . Only one of the last two operands is evaluated in a conditional expression Ex.

b=2.h> #include<iomanip.No. } } here. for {. break makes the compiler to transfer the control out of the loop. cout<<"\nHow many rows and columns required for matrix: ".j. int main() { int i = 1. if c=a/b the result of c will be 2 and if c=a%b. to j . void abc()... A function prototype is a declaration of the function that tells the program about the type of the value returned by the function and the number and the type of arguments. } f. ****. Do yourself. cout << ( i > j ? i : j ) << " is greater. int a=5. The prototype declaration looks just like a function definition except that it has no body. Ans 5 : a) #include<iostream.c. if { true/false condition break.h> #include<conio. Operator / is used to find the quotient while % is used to find the remainder in the c++ expression for ex. the control is transferred to "here" continue makes the compiler to execute the next iteration of the loop for { Condition.. the value of c will be 1 Q. b. continue.. j = 2.// compile with: /EHsc // Demonstrate conditional operator #include <iostream> using namespace std. clrscr( ).h> void main( ) { int A[10][10]. Page 12 of 26 .4 a. Ex.." << endl..N. } **** will not b executed and next iteration will happen continue can be given inside an if condition e. int i.

j++) cin>>A[i][j]. for(i=0.h> long f =1.i++) { for(j=0. cout<<endl.\n". } getch( ). cout<<"\nEnter the number to which you want to find factorial: ".h> Page 13 of 26 . cout<<"\nThe factorial of the number = "<<factorial(num). } clrscr( ). for(i=0.i++) { for(j=0.. for(i=0. for(j=0.j++) if((i==j)||((i+j)==(N-1))) cout<<setw(6)<<A[i][j].. else cout<<" ".i<N. long factorial(int n) { if (n==0) return f.h> #include<conio.j<N.i++) { cout<<"Enter the elements into Row "<<i+1<<": ". long num. cin>>num. } cout<<"\n\n\nThe elements which are belongs to only diagonals.i<N.i<N. else f=n*factorial(n-1).j<N. cout<<"\nEnter "<<N*N<<" elements: ".j++) cout<<A[i][j]<<"\t".j<N. } b) #include<iostream. getch( ). } c) #include<iostream. } void main( ) { clrscr( ).cin>>N. } cout<<"\nThe entered elements in the matrix are: \n". cout<<endl.

int A[20].h> #include<conio.i<N.i<N. cout<<"\nEnter the Paragraph ie message: \n". if (charcount%80==0) lines++. gets(str).++i) for(j=0.h> void main( ) { char str[300].j++) if(A[j]>A[j+1]) { Temp=A[j]. clrscr(). cout<<"\nNumber of Lines in the entered message: "<<lines. cout<<"\nNumber of Words in the entered message: "<<words. getch( ). } cout<<"\nNumber of Characters in the entered message: "<<charcount.h> void main( ) Page 14 of 26 . int i. } cout<<"The Elements in the array after sorting…. cin>>N.#include<conio. for(i=0. A[j+1]=Temp. A[j]=A[j+1]. ".j. } d) #include<iostream.temp.i++){ cout<<A[i]<<'\t'.lines=1.words=1.N.j<(N-1)-i .i<N.i++) { charcount++.h> #include<math.i++) cin>>A[i]. } e) #include<iostream.h> #include<conio.i.h> #include<stdio. for(i=0.h> void main( ) { clrscr( ). //Bubble sort technique for(i=0. if(str[i]==’ ‘) words++. for(i=0.charcount=0. cout<<”\nEnter the number of elements:”.str[i]!='\0'.

cout<<"\nD1: "<<d1. cout<<"\nEnter the value of b.a and c: ".a. else { cout<<"\nRoots are complex.c. cin>>b>>a>>c. double d1.d. } } Page 15 of 26 . getch( ).{ clrscr( ). else if(d>=0) cout<<"\nRoots are Real".. cout<<"\nD2: "<<d2. d2=(b+d)/(2*a). if(d==0) cout<<"\nRoots are equal or distinct".d2. d=(b*b-sqrt(4*a*c)) Imaginary". d1=(-b+d)/(2*a).

3 a) Find the output of the following program.x<strlen(NAME). what are the different types of printer. why analytical engine often called the pioneer computer. } void main() { int YourNum=20. Why primary memory is termed as ‘destructive write’ memory but ‘non-destructive read’ memory f. c. Explain different types of RAM d. for(int x=0.No. (i) All questions are compulsory.2 a. } b. What do you mean by ports.I+=5) cout<<I<<”. void main() { char *NAME=”a ProFiLe!”. } void Control(int &MyNum) { MyNum+=10.I<=HisNum. cout<<”Number=”<<YourNum<<endl. Explain in brief d. Control(YourNum).”.No.1 a. Q. 3 Q. Define the term ASCII and ISCII. Explain the different features of OOP.No. Define Analog an Digital Computer b. What are the different Data representation schemes c.h> void Withdef(int HisNum=30) { for(int I=20. #include<iostream. Withdef(MyNum). What is the difference between copying and moving files and folders e. b. else 3 Page 16 of 26 .Set III Sample Paper Class XI Subject – Computer Science Time: 3Hours Maximum Marks: 70 Note. What functions are performed by an operating system as a resource manager Q. Withdef(). cout<<endl.x++) if(islower(NAME[x])) NAME[x]=toupper(NAME[x]). Explain in brief all types of ports 4 e.

} g. cout<<NAME<<endl. What is difference between Actual parameter and Formal parameter? Give an example in C++ to illustrate both type of parameters. Explain different jump statements with suitable example. for(i=0. rewrite the following code using do-while loop int i . identify the error(s) in the following code fragment char ch.1 . How Many time the following code will be executed int i = 1 . int v=0. i++ . cout<<”enter character”. default : ++o. while(i) { cout<<”it’s a while loop”. while ((ch>=’A’ && ch<=’Z’)||( ch>=’a’ && ch<=’z)) { switch(ch) { case ‘a’: case ‘e’: case ‘i’: case ‘o’: case ‘u’: case ‘U’: ++v. }cout<<v. else NAME[x]--. } d.<<” ”<<o. e. i++ cout<<i. } c.i<10. f. } Page 17 of 26 .i++) { cout<<i.o=0.if(isupper(NAME[x])) if(x%2!=0) NAME[x]=tolower(NAME[x-1]). break. i= i .

Semantics refers to the set of rules which give the meaning of a statement.Explain briefly the function performed by an operating system as processor manager. Give examples of each type of memory.Syntax Errors: Syntax errors occur when rules of a programming language are misused. (semicolon) at the end of statement. what is the significance of Recycle Bin c.2 a. What do you meant by a lexical unit? Give an example. secondary storage devices are used to store large amount of data permanently. 2 Page 18 of 26 . Primary Memory: RAM (Random Access Memory) and ROM (Read only Memory) comes under primary memory. Syntax refers to formal rules governing the construction of valid statements in a language.. Eg: X * Y = Z. what is relation between Microprocessor and Microcomputer 2 Ans. Explain the concept of time sharing d. Eg: int a. But the content of RAM is not permanent. RAM is volatile memory and ROM is non volatile memory. What is meant by the term multiprogramming and multitasking e . Q. a. Briefly Distinguish between a general purpose and special purpose computer 2 Q. DVDs ----. There are 5 types of tokens. 2. 2 2 A) Token: The smallest individual unit in a program is known as a token (Lexical Unit). There are various types of secondary devices available these days. Eg: Hard disks. c.Magnetic Media CD ROMS. All the data and programs must be stored in RAM for execution. (Siva plays Guitar is Syntactically and Semantically correct but Guitar plays Siva is Syntactically correct but Semantically incorrect).Semantics Error: Semantic errors occur when statements are not meaningful.Set IV Sample Paper Class XI Subject – Computer Science Time: 3Hours Maximum Marks: 70 Note. Floppy disks ----.b //Did not keep .No.No. 3 A) 1.1. Microcomputer is a computer that contain a Microprocessor e. What is the difference between semantics error and syntax error? Give an example of each. (i) Keywords (ii) Identifiers (iii) Literals (iv) Punctuators (v) Operators d.Differentiate between primary memory and secondary memory. (i) All questions are compulsory. 2 2 2 2. what is the shortcut menu ? what is its significance b. A)The memory inside the CPU is primary memory (main memory) and the memory outside it is known as secondary(auxiliary) memory. Eg: RAM. ROM.Optical Media b. Secondary Memory: Since primary memory has a limited storage capacity and is not permanent.

Differentiate between object oriented programming and procedural oriented programming with the help of examples of each.Differentiate between call by value and call by reference with help of an example. actual arguments will be copied into the formal perameters.math. (i) The switch statement differs from the if statement in that switch can only test for equality whereas if can evaluate a relational or logical expression. if any modification is occurred to the formal perameter (reference to the actual argument). (ii) The switch statement selects its branches by testing the value of same variable whereas the if else construction lets you use a series of expressions that may involve unrelated variables and complex expressions.3 a.h Q. } Here a is called by “call by value” method and b is called by “call by reference” So as the value of a is changed. In call by reference. A)The if-else and switch both are selection statements and they both let you select an alternative out of given many alternatives by testing an expression. i)getch() ii) isalpha() iii)strcpy() iv)sqrt() A) (i) getch( ) .Q.h (iv)sqrt( ) .string. the actual argument value will be changed. A)(i)In call by value. (ii)In call by value.4 a.No.Distinguish between if and switch statement. (iv) Example: void Change(int a. object represents an entity that can store data and has its interface through functions b.No. Object Oriented Programming: The object oriented approach views a problem in terms of objects involved rather than procedure for doing it. But there are some differences in their operations. actual argument for a will not be changed. b=20.conio. if any modification is occurred to the formal perameter. int &b) { a= 2*a. 3 A. that change will not reflect back to the actual argument. as the value of b is changed.Write the names of the header files of the following functions.h (ii)isalpha( ) – ctype. Ie multiple conditions. We should go for call by value when we want to modify the original value.h (iii)strcpy( ) . formal perameters are references to the actual arguments. In call by reference. 4. (iii) We should go for call by value when we don’t want to modify the original value. c. There is no much security for the data. actual argument for b will be changed d. What will be the output of the following program? 3 2 4 3 Page 19 of 26 . (iii) The if-else can handle ranges whereas switch cannot. The focus is on the processing. Procedure Oriented Programming: A program in a procedural language is a list of instructions where each statement tells the computer to do something. In object oriented programming.

h> void main( ) { struct movie { char movie_name[20].x=0. } c. #include <iostream.Write the output of the following program. Movie. char movie_type. }movie.Rewrite the following program after removing the syntactical error(s) if any. Define the terms Polymorphism & Inheritance.h> int main { struct movie { char movie_name[20].movie_type. gets( main() { int i=0.ticket_cost=100. if(x++ = = 5) cout<<”five”<<endl.i<10. cin>>Movie. #include<iostream. gets(movie_type). } cout<<”\n”<<x.i*=2) { x++.movie_name). for(i=1. gets(movie_name). Underline each correction. else 3 2 3 Page 20 of 26 . }Movie. char movie_type.h> void main() { int x = 5. cout<<x. int ticket_cost. } b. } A) #include<iostream. d.h> #include<stdio. int ticket_cost=100.

Write a function to find simple interest 3 2 4 Page 21 of 26 . display(n1). n2.no1 + = 1. Write a program to add two matrices of same order MXN. n3 = n1. n2 = n3.no1 + = 5. Write a program to find either given no is prime or not 3 e.if(++x = = 6) cout<<”Six”<<endl. 4 d.100}.no1 . Write a program to find the factorial of any given number 3 b. n3. n1.5 a. make use of above declaration to write program segment that print id_no and name for all those whose age exceeds 60. display(n3).No. n2.-n. age.no1++<<”Number2=”<<. display(n2). n3.= 5. convert (4A8c)16 into binary number Q. void display(number n) { cout<<”Number1=”<<n. Assuming suitable data types give necessary declaration for an array of 20 voter records each record of which consists of four data values viz. } void main( ) { number n1={10. } e) What will be the output of the following segment? struct number { int no1. }. address.no2<<endl. n2.no2 * = 2. } f. 5 c. no2.

f. B2).2 a.Set V Sample Paper Class XI Subject – Computer Science Time: 3Hours Maximum Marks: 70 Note.h> jampto(int. cout<<A1<<B2<<endl.1 a. cout<<A1<<B2<<endl. cout<<A1<<B2<<endl. Define Microcomputer c. intn2=20) { n1=n1+n2. } (b) Find the output : void result(int &x. what is the function of memory and what are its measuring units e.second). Underline the correction #include <iostream. } void jumpto(int n1. x + = temp. jumpto(first. Write the header file for the given function abs(). (i) All questions are compulsory. g. sqrt(). result(A1. what do you mean by language processor. Expand the following: i)CPU ii) ROM iii)MICR iv)CD-R 2 Q. what is the difference between save and save as command.No. int ) void main() { first=10. } 3 2 2 1 2 2 2 2 2 Page 22 of 26 . jumpto(second). int y=10) { int temp = x + y. } void main( ) { int A1=10. second=20. result(A1). what is data and what is the output of data processing system d. Rewrite the following code after removing the syntax error if any. result(B2). setw() b. B2=5.No. Q. if(y <=10) y + = temp. isdigit().

Explain the types of errors in c++ c.4 a. What is data abstraction? Explain the concept with the help of an example.”bng”}. char city[][10]={“del”. x++. for(int i=0. Find the output #include <iostream.3 a.No. Chn:kol:chn 3. what do you mean by literals? What are the different kind of literals b.h> void main( ) { int i = 0.1415*r*r*r). } e. What do you mean by nested structure? Explain with suitable example b. Kol:chn:kol Q.”bom”. cout<<city[fly]<<”:” } } Output:1. } ++ i. What do you mean by code generation Q. f. what do you mean by dynamic and static allocation e.D.”chn”.i<3. Find the correct possible output void main() { randomize(). }while(i<10). Explain any two string handling functions with syntax and examples 3 3 3 2 2 3 1 2 2 3 3 Page 23 of 26 . int fly . what is the difference between ‘a’ and “a” in c++.kol 2. do { if(i % 5 = = 0) { cout<<x. x = 0.i++) { fly = random(2)+1. Convert the following equations to C++ statements. ii) V = 4/3Πr3 A) V = 4/(3*3. i) s = 1+1/x+1/x2+1/x3 A) s = 1 + 1/x + 1/(x*x) + 1/(x*x*x). Kol:bom:bng 4. Del:chn.”kol”. d. c.No. what is the difference between structure and arrays d. cout<<”\n”<<x.

N. cout<<"\nHow many rows and columns required for matrix: ". g. } cout<<"\n\n\nThe elements which are belongs to only diagonals..e.20)16= (?)2= (?)8 ii) (4A56)16= (?)10= (?)8 f. for(i=0. cout<<"\nThe entered elements in the matrix are: \n". Write a program to print the diagonal (left & right) elements of an N N matrix. int i. cout<<endl. A) //Program to print the left and right diagonal element of an NXN matrix #include<iostream.h> #include<conio.j++) if((i==j)||((i+j)==(N-1))) cout<<setw(6)<<A[i][j].i++) { cout<<"Enter the elements into Row "<<i+1<<": ".\n".h> #include<iomanip.i++) { for(j=0. cin>>N. for(j=0. Find the 1’s and 2’s complement of 128. } clrscr( ). } getch( ).j<N. for(i=0. else cout<<" ".h> 4 3 2 4 Page 24 of 26 . for(i=0. cout<<endl.No.i<N. explain a nested for with suitable example Q. i)(AC.4 a.j<N.i<N.i<N.i++) { for(j=0. } b.j. cout<<"\nEnter "<<N*N<<" elements: ".. clrscr( ).h> #include<conio.j++) cin>>A[i][j]. A) #include<iostream.j<N. Write a program to find the factorial of a number recursive function.h> void main( ) { int A[10][10].j++) cout<<A[i][j]<<"\t".

cout<<"\nEnter the number to which you want to find factorial: ".words=1.Write a program to find the total number of characters. else f=n*factorial(n-1).str[i]!='\0'. cout<<"\nEnter the Paragraph ie message: \n".h> #include<conio.h> void main( ) { clrscr( ). if(str[i]==' ‘) words++. int i. } c. } void main( ) { clrscr( ).h> #include<conio. cout<<"\nThe factorial of the number = "<<factorial(num). 3. if (charcount%80==0) lines++. cout<<"\nNumber of Lines in the entered message: "<<lines. cout<<"\nNumber of Words in the entered message: "<<words.long f =1. long num.h> void main( ) { char str[300]. getch( ).i++) { charcount++. 4 A) #include<iostream.h> #include<stdio. clrscr(). A) #include<iostream. getch( ). Avoid duplication of elements.lines=1. gets(str). cin>>num. long factorial(int n) { if (n==0) return f. lines and words in a paragraph of text.Write a program to sort an array on N numbers in ascending order.charcount=0. } cout<<"\nNumber of Characters in the entered message: "<<charcount. for(i=0. } d. 4 Page 25 of 26 .

} e. if(d==0) cout<<"\nRoots are equal or distinct". else cout<<"\nRoots are complex. double d1. cout<<"\nD2: "<<d2.d. d=(b*b-sqrt(4*a*c)).j. cin>>N.Write a program to find the roots of a quadratic equation..j++) if(A[j]>A[j+1]) { Temp=A[j].N. } cout<<"The Elements in the array after sorting….a and c: ".j<(N-1)-i .i<N.c. d1=(-b+d)/(2*a).temp. A[j+1]=Temp. A[j]=A[j+1]. cout<<"\nD1: "<<d1.h> #include<conio.i.h> void main( ) { clrscr( ). for(i=0. d2=(b+d)/(2*a). } 2 Page 26 of 26 .i++) cin>>A[i].ie Imaginary".h> #include<math. cout<<"\nEnter the value of b. for(i=0. else if(d>=0) cout<<"\nRoots are Real".int A[20]. A) #include<iostream. cout<<”\nEnter the number of elements:”. cin>>b>>a>>c.i++) cout<<A[i]<<'\t'.i<N.a. getch( )..++i) for(j=0.i<N.b. //Bubble sort technique for(i=0.d2. ".