Você está na página 1de 3

Class XI Full Marks : 40 Instructions : 1. All Questions are compulsory. 2.

. The programs should be written following C++ Language syntax. 3. Part A carries 12 marks , Part B carries 12 marks and Part C carries 16 marks Part A Q1. C++ Functions can make life of a programmer easy. Justify this statement. (2) Q2. Differentiate between a function and a program. (1) Q3. Discuss the mechanism of function call in a program, giving appropriate example. (2) Q4. Write down the prototype of the following library function, their header files. (4) a) strlen( ) , b) strcmpi( ) , c) atoi( ) , d) delay( ) Q5. Differentiate between Call by Value and Call by Reference, in context of function. Give proper example. (3) Part - B Q6. Find the error(s) in the following code snippet (if any) : a) main() { int s = 4 , a = 1; char n[s]; while( !a && s>= 0) { cout<<Enter No : ; cin>>n[s]; cout<<Want to input more [0. No \ 0. Yes]; cin>>a ; s--; } } (2) Duration : 2 hrs.

b)

void default ( int , int , char); main( ) { int a , b ; a = 30 , b = 40; cout<<< b; default(a , b); } void default( int a , int b , char c ) { if ( c == y || c == Y) { return (a+b); } else { return (a b) ; } return 0; }

(2)

c)

main( ) { int arr[6] = { 13 , 4 , 6 , 18 , 20 , 23 , 14}; while( i <= 3) { if (arr[ i ] % 2 == 0) { cout<<arr[ i ] ; } }

(2)

Q7. What would be the output of the following program code, assume that all the necessary header files are included. a) void IncreaseValueBy10( int) ; // function prototype; main( ) (2) { int a ; a = 17 ; cout<<a; IncreaseValueBy10(a); //calling the function. cout<<a; } void IncreaseValueBy10(int a) { a = a + 10; } b) main( ) (2) { char Menu[ ] [ ] = {

File , Edit , View, Insert , Format };

char k[30]; for (int i = 0 , j = 4 ; j>= i ; i++ , j--) { strcpy( k , Menu[i]); strcpy(Menu[i] , Menu[j]); strcpy(Menu[j] , k); } for( int i = 0 ; i <= 4 ; i++) { puts(Menu[i]); } } c) main() { int i = 0; char MyStr[] = Bhawanipatna; while(MyStr[i] != NULL) { (2)

if(MyStr[i] >= 100 && MyStr[i] <= 120) MyStr[i] = i++; } puts(MyStr); } PART - C Q8. Write a function which returns the salary of an employee based on the following criteria: (4) QUALIFICATION i) Graduate ii) Graduate iii) Graduate EXPERIENCE No Exp ( 0 yrs) 1 -3 yrs. > 3yrs SALARY Rs. 2000 Rs. 3500 Rs.3500 + Rs. 500 for each extra years above 3 yrs. (for exp if a Graduate is having 6 yrs. Of service , he will get : 3500 + 500 + 500 + 500 = 5000) Rs. 5000 Rs. 10000

iv) Post Graduate v) Post Graduate

No Exp > 5 yrs.

Q9. Write a function which inputs an array of ten numbers and then returns the sum of all the even numbers present in that array. (4) Q10. Write a function which finds the number of occurrences of given character at odd position in given string. For example if the function takes Kaustava and a , then it returns 2. Also call this function appropriately. (4) Q11. Write a program to find the difference of the sum of elements of upper and lower triangle of a two dimensional matrix. (4) OR Write a program to count the Uppercase Vowels present in a given string.

Você também pode gostar