Вы находитесь на странице: 1из 3

S P EC T R U M STUDY CIRCLE

ND
15/22 2 FLOOR ASHOK NAGAR ND-18 (PH – 55711031, 9810378235)

XI C++ SERIES 2 VINOD GANDHI

Instructions Attempt All Questions MM: 30


PROGRAMMING LANGUAGE IS C++ Time: 1 hour

Q1. Explain the Basic concepts of O O P with examples


5
Or
Explain the Basic Architecture of computer. What are the basic types of
software? What are the major strengths and weaknesses of computer?

Q2. a) What factors guide the choice of identifiers in programs?


5
Or
What is the difference between Run-time error and syntax Error. Give one
example of each.

b) What is the difference between ‘a’ and “a” in c++?

c) Why we use main function and <iostream.h> in program?

d) Why is char of ten treated as integer data type?


Or
What is Reference variable? What is wrong with Const int y ;

e) Why structure is preferred over array?


Or
Consider
char grade = 65 ;
char grade = ‘A’ ;
ARE they equivalent?

Q3. a) When are unsigned integers preferred over signed integers?


10

b) assuming res = 25, what will be output of


cout<< res - - ;
cout << + + res ;
Or
What will be result if ans = 700, val = 300 for expression
ans – ( val < 500? 150 : 50)

c) The following statement is illegal why? How would you correct it?
main( )
{
int i = j = k = 0 ;
}

d) Evaluate a+ = a++ + ++a if a = 20 initially


S P EC T R U M STUDY CIRCLE
ND
15/22 2 FLOOR ASHOK NAGAR ND-18 (PH – 55711031, 9810378235)
Or
Explain the purpose of using default in switch – case.

e) Find syntax error


# 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 ;
}

Q4. a) Write a program to find wheather given number is even or odd.


5

b) Consider
// version 1 // version 2
. .
. .
. .
while ( ch ! = ‘&’) while ( ch ! = ‘&’)
{ {
cin>> ch ; cin >> ch ;
if ( ch = = ‘ ‘ ) if ( ch = = ‘ ’ )
Spaces ++ ; Spaces ++ ;
If ( ch = = ‘\n’) else
Newlines ++ ; if ( ch == ‘\n’)
Newlines ++;
} }
. .
. .
. .
What advantages, if any, does the second version have over the first?

Q5. a) Rewrite following using switch


5
if ( ch = = ‘E’ )
eastern ++;
if ( ch = = ‘W’ )
western + + ;
if ( ch = = ‘N’ )
northern + + ;
if ( ch = = ‘S’ )
southern + + ;
else
unknown + + ;
S P EC T R U M STUDY CIRCLE
ND
15/22 2 FLOOR ASHOK NAGAR ND-18 (PH – 55711031, 9810378235)
Or

b) Write output of
# include<iostream.h>
void main()
{
long number = 5572331, result = 0 ;
do
{
result * = 10 ;
int digit = number % 10 ;
result + = digit ;
number/ = 10 ;
} while (number)
cout<<”output = ” <<result<< endl ;
}

Вам также может понравиться