Sample papers for Session Ending Exam XI CS 2015

advertisement
Sample Paper Class – I
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;
1
1
6
2
2
1
2
2
cout<<i++<<” ”<<i++<<” ”<<i++<<endl;
cout<<++i<<” ”<<++i<<” ”<<++i<<endl
ii)
2
2
2
2
}
# include<iostream.h>
void main( )
{
a=3;
a=a+1;
if (a>5)
cout<<a;
else
cout<<(a+5);
1
}
iii) What will be the output of the following program segment?
If input is as:
(a) g
(b) b (c) e (d) p
2
3
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
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
3
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)
2
3
{
cout<<“Notebook”;
} else
{
cout<<“Invalid Choice”;
}
}
}
c) Convert the following code segment into do-while loop.
#include<iostream.h>
void main()
{ int i;
for(i=1;i<=20;++i)
cout<<”\n”<<i;
}
3
d) Given the following code fragment
int ch=5;
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
6 a) Which header files are required for the following?
(i) frexp()( (ii) sqrt( ) (iii) rand( ) (iv) isupper()
2
b) Evaluate:
i)
(12)10 = ( X)2
ii) (347)8= (X)10
iii) (896)16= (X)8
iv) (100)10= (X)2
4
7 a) Write a C++ program to check a year for leap year or not.
b) Write a C++ program to check a number for Armstrong or not.
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.
3
2
4
4
4
2
Sample Paper - II
Subject – Computer Science
Max Marks 70
Duration 3 hrs
Note:- All questions are compulsory
Q1)
a) What is significance of My Computer
?
2
b) Explain different types of operating systems .
1
c) What is an Operating System? Explain its any two functions
2
d) How is a compiler different from interpreter?
e) Convert
(i) ( 10.10)10= ( ? )2
2
(ii) (101011.1110)2 =( ? )10
2
Q2)
a) What do you mean by run time error?
1
b) what is the deference between if and if – else statement
2
c) Mention and explain briefly any three characteristics of a good program
2
d) How can you give a single line and multiline comments in C++ explain with
suitable examples
2
e) what do you mean by header files? What is the difference between #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.1
b) Give output of following code.
#include<iostream.h>
int m=5; void check();
void main( )
{ int m=20;
{
int m=10*::m;
cout<<"m="<<m<<"::m="<<::m<<endl;
} check();
cout<<"m="<<m<<"::m="<<::m<<endl;
check(); cout<<"::m="<<::m<<"m="<<m<<endl;
}
void check()
{ ++m;
}
4
2
3
c) What will be result of following statements if a=5 , 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.
2
void main( )
{
char name[40];
strcpy(name,”India”);
puts(name); }
e) Explain conditional operator (?) with example in c++ .
2
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++
2
b) Explain Break and Continue statement in C++ with example.
2
c) Find syntax error(s) if any in following program ( Assume all header files are present) 2
main<>
{ int c;
switch( c );
case 1.5: { cout<<” India is great\n”;
} break;
‘case’ 2: { cout<<” hello\n”;
} break;
} // 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
1
e) Convert following while loop to for loop
int x=0;
while(x<=100)
{ cout<<” the value of x is \n”<<x;
cout<<”done \n”;
x+=2;
}
2
f ) Define token ?
1
g) What is the difference between call by value and call by reference explain with
suitable example
5
2
h)Find the output of the following program;
#include<iostream.h>
#include<ctype.h>
void main( )
{ char Text[ ] = “Comp@uter!”;
for(int I=0; Text[I]!=’\0’;I++)
{ if(!isalpha(Text[I]))
Text[I]=’*’;
else if(isupper(Text[I]))
Text[I]=Text[I]+1;
else
Text[I] = Text[I+1]; }
cout<<Text; }
3
i) What are differences between for and do- while loop ?
explain with example
j) How can you define Global Variable and Local Variable? Also, give a
code to illustrate both.
suitable C++
Q5 : a) Write a program to print the left and right diagonal element of an NXN matrix
b) b. Write a program to find the factorial of a number recursive function.
c) Write a program to find the total number of characters, lines and words in a
paragraph of text.
d) Write a program to sort an array on N numbers in ascending order. Avoid
duplication of elements.
e) Write a program to find the roots of a quadratic equation.
6
2
2
4
4
4
4
4
Sample Paper - III
Subject – Computer Science
Time: 3Hours
Maximum Marks: 70
Note. (i) All questions are compulsory.
Q.No.1
a. Define Analog an Digital Computer
b. why analytical engine often called the pioneer computer.
c. what are the different types of printer. Explain in brief
d. What is the difference between copying and moving files and folders
e. What functions are performed by an operating system as a resource manager
Q.No.2
a. Define the term ASCII and ISCII.
b. What are the different Data representation schemes
c. Explain different types of RAM
d. What do you mean by ports. Explain in brief all types of ports
4
e. Why primary memory is termed as ‘destructive write’ memory but ‘non-destructive read’
memory
f. Explain the different features of OOP.
3
Q.No.3
a) Find the output of the following program.
3
#include<iostream.h>
void Withdef(int HisNum=30)
{
for(int I=20;I<=HisNum;I+=5)
cout<<I<<”,”;
cout<<endl;
}
void Control(int &MyNum)
{
MyNum+=10;
Withdef(MyNum);
}
void main()
{
int YourNum=20;
Control(YourNum);
Withdef();
cout<<”Number=”<<YourNum<<endl;
}
b. void main()
{
char *NAME=”a ProFiLe!”;
for(int x=0;x<strlen(NAME);x++)
if(islower(NAME[x]))
NAME[x]=toupper(NAME[x]);
else
7
if(isupper(NAME[x]))
if(x%2!=0)
NAME[x]=tolower(NAME[x-1]);
else
NAME[x]--;
cout<<NAME<<endl;
}
c. How Many time the following code will be executed
int i = 1 ;
i= i - 1 ;
while(i)
{
cout<<”it’s a while loop”;
i++ ;
}
d. What is difference between Actual parameter and Formal parameter? Give an example in C++ to
illustrate both type of parameters.
e. Explain different jump statements with suitable example.
f. rewrite the following code using do-while loop
int i ;
for(i=0;i<10;i++)
{
cout<<i; i++ cout<<i;
}
g. identify the error(s) in the following code fragment
char ch; int v=0,o=0;
cout<<”enter character”;
while ((ch>=’A’ && ch<=’Z’)||( ch>=’a’ && ch<=’z))
{
switch(ch) {
case ‘a’:
case ‘e’:
case ‘i’:
case ‘o’:
case ‘u’:
case ‘U’: ++v; break; default : ++o;
}cout<<v;<<” ”<<o;
}
8
Download