ISC Computer 2015 Practical Paper Solved
Question :1
Inputs two integers M and N and
display the number greater than M whose digit’s sum is equal to N and number of
digits of new number.
Sample
Input :
M
= 110
N
= 11
Sample
Output :
The
Required Number is : 119 (1 + 1 + 9 = 11)
Total
Number of Digits is : 3
//Publisher
: Sharma Tutorials Jamshedpur
//Author
: Shubham Kumar Sharma
//Uploaded
At : sharmatutorialsjsr.blogspot.com
import
java.util.*;
public
class Number
{
public static void main()
{
Scanner in=new Scanner(System.in);
intm,n,t,s=0,d=0,r;
System.out.print("Enter
the Value of M : ");
m=in.nextInt();
System.out.print("Enter
the Value of N : ");
n=in.nextInt();
if((m>=100)&&(m<=10000)&&(n<100))
{
while(true)
{
t=m;
for(;t!=0;)
{
r=t%10;
s=s+r;
t=t/10;
d++;
}
if(s==n)
{
System.out.println("The
Required Number is : "+m);
System.out.println("Total
Number of Digits is : "+d);
break;
}
s=0;
d=0;
m++;
}
}
else
{
System.out.println("INVALID
INPUT");
}
}
}
Question : 2
Inputs
a matrix of order M
M and displays original matrix, rotated matrix
and sum of corner elements.
Sample
Input :
1 2 3
2 4 5
3 5 6
Sample
Output :
ORIGINAL
MATRIX
1 2 3
4 5 6
7 8 9
MATRIX
AFTER ROTATION
7 4 1
8 5 2
9 6 3
Sum
of the corner elements : 20
//Publisher
: Sharma Tutorials Jamshedpur
//Author
: Shubham Kumar Sharma
//Uploaded
At : sharmatutorialsjsr.blogspot.com
import
java.util.*;
public
class Matrix_1
{
public static void main()
{
Scanner in=new Scanner(System.in);
intm,i,j,s;
System.out.println("Enter
size of matrix : ");
m=in.nextInt();
if((m>2)&&(m<10))
{
inta[][]=new
int[m][m];
intb[][]=new
int[m][m];
System.out.println("Enter
Elements in the matrix : ");
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
a[i][j]=in.nextInt();
}
}
System.out.println("ORIGINAL
MATRIX");
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
System.out.print(a[i][j]+"\t");
}
System.out.println();
}
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
b[j][m-1-i]=a[i][j];
}
}
System.out.println("MATRIX
AFTER ROTATION");
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
System.out.print(b[i][j]+"\t");
}
System.out.println();
}
s=a[0][0]+a[0][m-1]+a[m-1][m-1]+a[m-1][0];
System.out.println("Sum
of the corner elements : "+s);
}
else
System.out.println("SIZE
OUT OF RANGE");
}
}
Question : 3
Inputs
a sentence and coverts all the first letter of a word to upper case and display
the number of vowels and consonants present in each word of a sentence.
Sample
Input :
Shubham
kumarsharma solved ISC questions at sharma tutorials jamshedpur.
Sample
Output :
New
Sentance :
Shubham
Kumar Sharma Solved ISC Questions At Sharma Tutorials Jamshedpur.
Words Vowels Consonants
Shubham 2 5
Kumar 2 3
Sharma 2 4
Solved 2 4
ISC 1 2
Questions 4 5
At 1 1
Sharma 2 4
Tutorials 4 5
Jamshedpur 3 7
//Publisher
: Sharma Tutorials Jamshedpur
//Author
: Shubham Kumar Sharma
//Uploaded
At : sharmatutorialsjsr.blogspot.com
import
java.util.*;
public
class Vowels_Consonants
{
public static void main()
{
Scanner in=new Scanner(System.in);
String s,w[],u="";
inti,j,v=0,co=0;
char c;
System.out.println("Enter
Your Sentence : ");
s=in.nextLine();
if((s.charAt(s.length()-1)=='.')||(s.charAt(s.length()-1)=='?'))
{
u=u+Character.toUpperCase(s.charAt(0));
for(i=1;i<s.length();i++)
{
if((s.charAt(i)=='
')&&(Character.isLetter(s.charAt(i+1))))
u=u+'
'+Character.toUpperCase(s.charAt(++i));
else
u=u+s.charAt(i);
}
System.out.println("New
Sentance : "+u);
w=u.split("[.? ]+");
System.out.println("Words\t\tVowels\tConsonants");
for(i=0;i<w.length;i++)
{
for(j=0;j<w[i].length();j++)
{
c=w[i].charAt(j);
if((c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u')||(c=='A')||(c=='E')||(c=='I')||(c=='O')||(c=='U'))
v++;
else
co++;
}
System.out.println(w[i]+"\t\t"+v+"\t"+co);
v=0;
co=0;
}
}
else
System.out.println("Invalid
Input");
}
Nice very helpful
ReplyDeleteThank you
Thanks u helped alot.
ReplyDelete