Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Abuse of notation wikipedia , lookup
Functional decomposition wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Dirac delta function wikipedia , lookup
Large numbers wikipedia , lookup
Series (mathematics) wikipedia , lookup
History of the function concept wikipedia , lookup
Proofs of Fermat's little theorem wikipedia , lookup
Non-standard calculus wikipedia , lookup
Function (mathematics) wikipedia , lookup
Padma Seshadri Bala Bhavan Senior Secondary School, K.K.Nagar XI Std. – Exercise (2015-16) Write answers in A4 sheet and submit it. 1. Write a function named Armstrong(int m) which accepts the limit as an argument and prints all Armstrong numbers upto that limit. Write main() to execute this function. 2. Write a function named prime(int m) which accepts the limit as an argument and prints all prime numbers upto that limit. Write main() to execute this function. 3. Write a function named perfect(int m) which accepts the limit as an argument and prints all perfect numbers upto that limit. Write main() to execute this function. 4. Write a function named fiboprime(int n) which accepts the limit as an argument and prints all Fibonacci numbers upto the limit and check if that numbers are prime or composite. Write main() to execute this function. 5. Write a function named palindrome(int a) which accepts an integer as an argument and checks if it is a palindrome or not . Write main() to execute this function. Padma Seshadri Bala Bhavan Senior Secondary School, K.K.Nagar XI Std. – Computer Science – Practice Paper (2015-16) 1. What is the difference between „a‟ and “a”. 2. What is an array? Explain with an example. 3. Write the number of bytes occupied by the following variables. a) int a; b) char b[20]; c) int y[]={1,2,3,4,5,6,}; d) char x[]=”Halfyearly\0”; 4. Check if the following declarations are correct. If not, give reasons. a) int b=10,20,30,40}; b) int a[][3]={2,4,-5,-7,4,3}; c) char x[5]=”Clever students”; d) char a[]=”It is a rainy day”; 5. Debug the following programs and write the corrected coding only. a) #include(iostream.h) b) #include<iostream.h> void main() #include<stdio.h> { void main() int x[]={50,60,30,40},y; { count=4; char a[20],b; cin>>y; gets(a); for (i=count;i>0;i--) b="Study well"; { switch(i) if (a==b) { cout<<"Same words"; case 0: else case 1: cout<<"Different cout<<y*x[i]<<endl; words"; case 2: cout<<pow(x[i]); } case 3: cout<<x[i]; } } } 6. Predict the output of the following programs : a) #include<iostream.h> #include<ctype.h> void main() { char name[30]=”11std BriGht fuTUre”; for (int x=0;x<strlen(name);x++) if (islower(name[x])) name[x]=toupper(name[x]); else if (isdigit(name[x]) name[x]=name[x]+1; elseif (isupper(name[x])) if (x%2 !=0) name[x]=tolower(name[x]); else name[x]--; cout<<name; } void main() { char a[ ]="ExAm-2012 AheAd"; int i; for(i=0;a[i];i++) if(a[i]>=97 && a[i]<=122) a[i]--; else if(a[i]>='0' && a[i]<='9') a[i]=a[i-1]; else if(a[i]>='A' && a[i]<='Z') a[i]+=32; else a[i]='#'; puts(a); } b) 7. Write a program to accept 2 arrays A and B of same size in ascending order. Merge these two arrays in ascending order and print the resultant array. 8. Write a program to accept a 2d array of integers of odd number of rows and columns and display the elements of the middle row and the elements of the middle column. Example, if the array content is 3 5 4 7 6 9 2 1 8 The output is Middle Row : 7 Middle Column : 5 6 6 9 1 9. Write a program to accept a string and print number of vowels, number of uppercase characters present in that string. 10. Write a program to accept 2 arrays A and B of same size. Calculate their corresponding elements with the formula 2*A[i] + 3*B[i] where i varies from 0 to n-1 and transfer the resultant content in the third same sized array. Print the resultant array. 11. Write a program to accept a 2d array of integers and display the boundary elements as per the given example. Example, if the array content is 3 5 4 7 6 9 2 1 8 8 6 9 The output is 3 5 4 7 9 2 8 8 6 9 12. Write a program to accept a string and print the number of consonants, number of digits present in that string.