Trending ▼   ResFinder  

Class 11 CBSE HLY 2016 : Computer Science (Army Public School)

3 pages, 0 questions, 0 questions with responses, 0 total responses,    0    0
Somnath PaulChoudhury
St. Mary's ICSE School, Koparkhairane, Navi Mumbai
+Fave Message
 Home > spch >   F Also featured on: School Page

Formatting page ...

Roll No Code No 083 2 Army Public School Bengdubi Half Yearly Examination 2014-15 Class XI Science Sub: Computer Science Time 3 hours Max Marks 70 General Instructions: i). All Questions are compulsory. ii). Programming language C++. -------------------------------------------------------------------------------------------------------------------------------------- 1. Find the outputs and explain (a) for(int i=1;i<=5;i++) { for(int j=1;j<=i;j++) cout<<j<<" "; cout<<endl; } (b) for(int i=5;i>=1;i--) { for(int j=1;j<=i;j++) cout<<i<<" "; cout<<endl; } [5] 2. Find value (in a) or domain (as in c) or final value (as in b, d, e) of A in each case: [10] (a) int A = ((2344<9000)? 66:-77); (b) for(int A=50; A>-18; A--){ cout<<A--<<;} (c) int A=random(19); int Y=(16>A?45:33); cout<<Y; //outputs 33 (d) int A = 28; cout<<A<<" "<<A%3<<" "<<A++; (e) int A = 30; cout<<A<<" "<<A%7<<" "<<A*A; 3. What are logical error and run time errors? Which error pointed out by compiler during compilation? [3] 4. List the arithmetic operators as per their precedence. In the same level how are they evaluated? Explain. [4] 5. The following code failed while reversing a number. Correct the same. [3] long int i, num, storenum, rev; cout<<"Enter a number "; cin>>num; storenum=num; for(i=num; i>0; i/=10) { num=i%10; rev=rev*10+num; } cout<<"The number reversed is "<<rev<<endl; cout<<"The number was "<<storenum; What conclusion do you draw when the code worked thereafter? How will you find if the number is Palindrome or not? 6. Find the output for the sequence. [2] char name[]={"Army Welfare Education Society"}; for(int i=0; i<29; i++) { if(i%2!=1) cout<<name[i]<<" "; } 7. Read the code and answer the questions below [6] long int i, number, lengthofnum=0; cout<<"\nEnter a number \t"; cin>>number; (a) What is the purpose of \n and \t within quotes (b) How to find the length of the number? Write code. [do not use strlen()] 8. Read the code below and answer specifically char dir = 'a'; int x = 10, y = 10; cout << "Hit Enter to QUIT\n"; while(dir != '\r') { [10] cout << "\nYour location is " << x << " , " << y; cout << "\nPress direction key (n, s, e, w): "; dir = tolower(getche()); switch(dir) { .. .. .. } } (a) Why the declaration char dir = 'a'; before commencement of while loop is important ? (b) What does the condition dir != '\r' within while indicate ? (c) Which header file is required for the function tolower() ? (d) Complete the code within switch...case so that it can identify if n, s, e or w is pressed and appropriate change in x, y coordinate takes place. Note: Point of reference or 0,0 is top left corner of the screen. 9. Consider the 3 lines of code below [6] int num1, num2, num3; cout<<"\nEnter 3 numbers in succession "; cin>>num1>>num2>>num3; (a) Using logical AND (&&) determine the largest amongst three numbers. (b) What is understood by the statement !(x<25) List logical operators as per precedence. 10. Explain the working of strcmp() when the strings used in the parameter are "Panighata" and "Pankabari". Discuss all possible outputs with supporting C++ code. [5] 11. WAP to input a number and determine the even factors of it. [4] 12. Explain explicit type casting. [2] 13. Write a list of functions associated with the header files ctype.h and string.h [4] 14. Using the user defined function int find_sum(int, int, int); find the sum of three integers. Use function prototype, call and function definition in the program separately. [6] |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

spch chat