Vous êtes sur la page 1sur 25

ANSWERS TO THE ASP!RE ASS!

CNNENTS:
unix assignment1:
UN!X Assignment 1
1.
Write a command to list all the files inside a folder i.e. if there is afolder inside a folder
then it should list all files inside the subfolder which is inside the folder to be listed.
Sol) $ find type f
2.
Search all the files which contains a particular string, say include"within a folder.
Sol) $ ls F]grep v */]xargs grep include$ find type f print0]xargs 0 grep include
3.
Rename all the files within a folder with suffix Unix_" i.e.suppose a folder has two files
a.txt and b.pdf than they both should be renamed from a single command to Unix_a.txt
and Unix_b.pdf
Sol) $ for f in $(ls F]grep v */),do mv "$f" "Unix_$f", done
4.
Rename all files within a folder with the first word of their content(remember all the
files should be text files. For example if a.txt contains Unix is an OS" in its first line
then a.txt should berenamed to Unix.txt
Sol) $ for f in $(ls]grep .txt),do mv "$f" "$(cat $f]tr ' ' '\n']head1)".txt,done
S.
Suppose you have a C project in a folder called project", itcontains .c and .h files, it
also contains some other .txt files and.pdf files. Write a Linux command that will count
the number of lines of your text files. That means total line count of every
file.(remember you have to count the lines in .txt files only)
Sol) $ ls]grep .txt]xargs wc -l
6.
Rename all files which contain the substring 'foo', replacing itwith 'bar' within a given
folder.
Sol) $ for f in $(ls F]grep v */]grep "foo"),do mv "$f" "${f//foo/bar}",done
7.
Show the most commonly used commands from history"? |hint:remember the history
command, use cut, and sort it]
Sol) $ history]cut d' ' fS]sort]uniq c]sort r]head S

unix assignment2:

Answer1
Nkdir training training/level1 training/level2 training/cep level1/sdp level1/re
level1/selevel2/sdp level2/re level2/se cep/sdp cep/re cep/se
Answer2
Cp -r dir1 dir2 command will copy a directory structure dir1 todir2
.Answer3
Ls lg command is used to find out if you have the permission to send a message.
Answer4
Ls -l command is used to display all the content of directory along with size in bytes.
AnswerS
Date +%T command is used to display date and time in 24hour format
.Answer6
Date +%t command is for printing the year, month, and date with a horizontal
tabbetween the fields.
Answer7
Cat > chapaContents of fileCtrl+DCat > chapb
Contents of fileCtrl+DCat > chapcContents of fileCtrl+DCat > chapdContents of
fileCtrl+DCat > chapeContents of fileCtrl+DCat > chapAContents of fileCtrl+DCat >
chapBContents of fileCtrl+DCat > chapCContents of fileCtrl+DCat > chapDContents of
fileCtrl+DCat > chapEContents of file Ctrl+DCat > chap01Contents of fileCtrl+DCat >
chap02Contents of fileCtrl+DCat > chap03Contents of fileCtrl+DCat > chap04Contents
of fileCtrl+DCat > chap0SContents of fileCtrl+DCat > chap11Contents of fileCtrl+DCat
> chap12Contents of fileCtrl+DCat > chap13Contents of fileCtrl+D Cat >
chap14Contents of fileCtrl+DCat > chap1SContents of fileCtrl+D
Answer8
Ls *|abcde] or Ls *|az]
Answer3
Ls *|AZ]
Answer10
Ls *0?
Answer11
Ls *|bde]
Answer12
Crep -c programmer personnel
Answer13
Sed -n '/programmer/p' personnel
Answer14
Sed 's/programmer/software professional/g' personnel
Answer1S
The command
sleep
waits a given number of seconds before continuing. Type
% sleep 10
This will wait 10 seconds before returning the command prompt %. Until the
commandprompt is returned, you can do nothing except wait

DBNS ASS!CNNENT 1:
ENP
ENP_NO NOT NULL NUNBER(4) ENP_NANE vARCHAR(2S) DES!CNAT!ON CHAR(4)
]O!N!NC_DATE DATE SALARY NUNBER(7,2) DEPT_NO NUNBER(2)
DEPT
DEPT_NO NOT NULL NUNBER(2) DEPT_NANE vARCHAR(2S) BUDCET NUNBER(1S,2)
NANACER vARCHAR(2S)
Create tables ENP, and DEPT, the structure for which are given above.
Write SOL queries for the following :
1. Display each employeea??s name and date of joining.
2. Display employees earning more than Rs.S,000. Label the column name
a??Employeea??.
3. Display all employee names and employee numbers in the alphabetical order of
names.
4. Display all employee names containing the letter a??Sa??.
S. Display the employees hired in 1381.
6. Display the minimum and maximum salary.
7. Display the list of employees along with their department name and its manager.
8. Display the number of different employees listed for each department.
3. Delete the records of all the employees hired in 1381 from ENP table.
10. Update the salary of all the employees to Rs. 10,000.
Answers:
11. select ENPNANE, ]O!N!NCDATE from emp
12. select ENP_NANE as Employee from emp where SALARY>S000
13. select ENPNANE, ENPNO from emp order by ENP_NANE
14. select ENPNANE from emp where ENPNANE like "%ra%"
1S. select ENPNANE from emp where YEAR(]O!N!NCDATE)=1381
16. select min(SALARY), max(SALARY) from emp
17. select e.ENPNANE, d.DEPTNANE, d.NANACER from emp e, dept d where
e.DEPTNO=d.DEPTNO
18. select count(*), d.DEPTNANE from emp e, dept d where e.DEPTNO= d.DEPTNO
group by e.DEPTNO
13. delete from emp where YEAR(]O!N!NC_DATE)=1381
20. update emp set SALARY=1000
]AvA ASS!CNNENT1

1. Write a program to find the difference between sum of the squares and the square of
the sums of n numbers?
Program:

import java.io.*,
importjava.util.Scanner,
class Difference
{
publicstaticvoid main(String args|]) throws!OException
{
Scanner s=newScanner(System.in),
System.out.println("Enter the value of n: "),
int n=s.next!nt(),
int a|]=newint|n],
int i, sqr, diff, sum=0, add=0,
System.out.print("The "+n),
System.out.println(" numbers are : "),
for(i=0,i<n,i++)
{
a|i]=s.next!nt(),
sum+=(a|i]*a|i]),
add+=a|i],
}
sqr=add*add,
diff=sqrsum,
System.out.println(""),
System.out.print("Sum of Squares of given "+n),
System.out.println(" numbers is : "+sum),
System.out.print("Squares of Sum of given "+n),
System.out.println(" numbers is : "+sqr),
System.out.println(""),
System.out.println("Difference between sum of the squares and the square of the sum
of given "+n),
System.out.print(" numbers is : "+diff),
System.out.println(""),
}
}
Out put:

Enter the value of n:
4
The 4 numbers are :
2
3
4
S

Sum of Squares of given 4 numbers is : S4
Squares of Sum of given 4 numbers is : 136

Difference between sum of the squares and the square of the sum of given 4
numbers is : 142



2. Develop a program that accepts the area of a square and will calculate its perimeter.


Program:

importjava.util.Scanner,


publicclassCalculateSquarePeri
{

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{

Scanner s=newScanner(System.in),
System.out.println("Area of Square : "),
double a=s.nextDouble(),
double p=4*Nath.sqrt(a),
System.out.println(""),
System.out.print("Perimeter of the Square : "+p),
System.out.println(""),
}



}


Output:

Enter the area:
23
Perimeter of the square is: 13.1833260332S0876







3. Develop the program calculateCylindervolume., which accepts radius of a cylinder's
base disk and its height and computes the volume of the cylinder.


Program:

import java.io.*,
importjava.util.Scanner,
classcalculateCylindervolume
{
publicstaticvoid main(String args|]) throws!OException
{
Scanner s=newScanner(System.in),
System.out.println("Enter the radius : "),
double rad=s.nextDouble(),
System.out.println("Enter the height : "),
doubleht=s.nextDouble(),
doublevol=Nath.P!*rad*rad*ht,
System.out.println(""),
System.out.println("volume of the cylinder is : " + vol),
}
}


Output:

Enter the radius :
12
Enter the height :
13

volume of the cylinder is : S881.061447S20033




4. Utopias tax accountants always use programs that compute income taxes even
though the tax rate is a solid, neverchanging 1S%. Define the program calculateTax
which determines the tax on the gross pay. Define calculateNetPay that determines the
net pay of an employee from the number of hours worked. Assume an hourly rate of
$12.


Program:

importjava.util.Scanner,


publicclasscalculateTax {

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s=newScanner(System.in),
System.out.println("Enter the no. of working days in the year : "),
int d=s.next!nt(),
System.out.println("Enter the no. of working hours in a day : "),
int h=s.next!nt(),
System.out.println("Enter the no. of hours worked in over time : "),
intot=s.next!nt(),
System.out.println("Enter the no. of hours took leave : "),
int l=s.next!nt(),
double gross=((d*h)+otl)*12,
double tax= gross*0.1S,
double net=grosstax,
System.out.println(""),
System.out.println("Cross Pay (in $) : "+gross),
System.out.println("Tax (in $) : "+tax),
System.out.println("Net Pay (in $) : "+net),

}


}




Output:

Days worked by employer in a year :
300
Enter the no. of working hours in a day :
6
Enter the no. of hours worked in over time :
1
Enter the no. of hours took leave :
1S60

Cross Pay (in $) : 2832.0
Tax (in $) : 433.8
Net Pay (in $) : 24S8.2




S. An oldstyle movie theater has a simple profit program. Each customer pays $S per
ticket. Every performance costs the theater $20, plus $.S0 per attendee. Develop the
program
calculateTotalProfit that consumes the number of attendees (of a show) and calculates
how much income the show earns.

Program:
importjava.util.Scanner,


publicclasscalculateTotalProfit
{

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s = newScanner(System.in),
System.out.println("Enter the no. of attendees of a show : "),
int n=s.next!nt(),
double profit = (n*S)(20+(n*0.S)),
System.out.println(""),
System.out.println("Total Profit of the theater per show (in $) is : " + profit),
}


}
Output:
Enter the no. of attendees per show :
S0

Total Profit of the theater per show (in $) is : 20S.0



7. Develop the program calculateCylinderArea, which accepts radius of the cylinder's
base disk and
its height and computes surface area of the cylinder.


Program:

importjava.util.Scanner,


publicclasscalculateCylinderArea
{

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s=newScanner(System.in),
System.out.println("Enter the base radius : "),
double rad=s.nextDouble(),
System.out.println("Enter the height : "),
doubleht=s.nextDouble(),
double area=2*Nath.P!*rad*(rad+ht),
System.out.println(""),
System.out.println("Surface Area of the cylinder is : " + area),
}

}



Output:

Enter the base radius :
12
Enter the height :
13

Surface Area of the cylinder is : 1884.3SSS321S387S8





8. Develop the program calculatePipeArea. !t computes the surface area of a pipe,
which is an open cylinder. The program accpets three values: the pipes inner radius, its
length, and the thickness of
its wall.

Program:

importjava.util.Scanner,


publicclasscalculatePipeArea
{

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s=newScanner(System.in),
System.out.println("Enter the inner radius : "),
double rad=s.nextDouble(),
System.out.println("Enter the length : "),
doublelen=s.nextDouble(),
System.out.println("Enter the thickness : "),
double thick=s.nextDouble(),
double area=2*Nath.P!*(rad+thick)*len,
System.out.println(""),
System.out.println("Surface Area of the pipe is : " + area),

}


}


Output:

Enter the inner radius :
13
Enter the length :
20
Enter the thickness :
S

Surface Area of the pipe is : 2261.346710S846S1

3. Develop the program calculateHeight, which computes the height that a rocket
reaches in a given amount of time. !f the rocket accelerates at a constant rate g, it
reaches a speed of g - t in t time units and a height of 1/2 * v * t where v is the speed
at t.

program:



importjava.util.Scanner,


publicclasscalculateHeight {

/**
* @paramargs
*/
publicstaticvoid main(String|] args) {
Scanner s=newScanner(System.in),
System.out.println("Enter the time (in seconds) : "),
double t=s.nextDouble(),
double v=3.8*t,
double height=0.S*v*t,
System.out.println(""),
System.out.println("Height reached (in meters) is : " + height),


}

}


Output:

Enter the time (in seconds) :
300

Height reached (in meters) is : 441000.0



10. Develop a program that computes the distance a boat travels across a river, given
the width of the river, the boat's speed perpendicular to the river, and the river's speed.
Speed is distance/time, and the Pythagorean Theorem is c2 = a2 + b2.

Program:

importjava.util.Scanner,


publicclassBoatDistance
{

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s= newScanner(System.in),
System.out.println("Enter the width of the river (in meters) : "),
doublerw=s.nextDouble(),
System.out.println("Enter the river's speed (in meter/sec) : "),
doublers=s.nextDouble(),
System.out.println("Enter the boat's speed (in meter/sec) : "),
doublebs=s.nextDouble(),
double time=rw/bs, //time takes to travel from shore to shore straight by the boat
double w2=time*rs, //distance due to down stream
doublebd=Nath.sqrt((rw*rw)+(w2*w2)),
System.out.println(""),
System.out.println("The distance travelled by boat (in meters) is : "+bd),
}


}


Output:

Enter the width of the river (in meters) :
1S
Enter the river's speed (in meter/sec) :
200
Enter the boat's speed (in meter/sec) :
2S0

The distance travelled by boat (in meters) is : 13.203372712238S46

11. Develop a program that accepts an initial amount of money (called the principal), a
simple annual interest rate, and a number of months will compute the balance at the
end of that time. Assume thatno additional deposits or withdrawals are made and that a
month is 1/12 of a year. Total interest is the product of the principal, the annual
interest rate expressed as a decimal, and the number of years.

Program:

importjava.util.Scanner,


publicclasscalculateBalance {

/**
* @paramargs
*/
publicstaticvoid main(String|] args)
{
Scanner s=newScanner(System.in),
System.out.println("Enter the principal amount : "),
double p=s.nextDouble(),
System.out.println("Enter the annual interest rate : "),
double r=s.nextDouble(),
System.out.println("Enter the no. of months : "),
double m=s.nextDouble(),
doublesi=(p*(m/12)*r)/100,
doublebal=p+si,
System.out.println(""),
System.out.print("Balance after " +(int)m),
System.out.println(" month(s) is : "+bal),
}


}

Output:

Enter the principal amount :
1S000
Enter the annual interest rate :
12
Enter the no. of months :
24

Balance after 24 month(s) is : 18600.0




]AvA ASS!CNNENT 2:
1.)Create a washing machine class with methods as switchOn, acceptClothes,
acceptDetergent,switchOff. acceptClothes accepts the noofClothes as argument S
returns the no of Clothes.

import java.util.*, class WashingNachine{Scanner input=new Scanner(System.in),public
void switchOn () {System.out.println ("The lid is open."),} public void start ()
{System.out.println ("Start washing ..."),} public void acceptDetergent ()
{System.out.println("Adding Detergent.. "),start(),}public
intacceptClothes(){System.out.println("Enter no of clothes: "),int
no=input.next!nt(),return no,}public void switchOff () {System.out.println ("The lid is
closed."),} public static void main(String|] args){WashingNachinewm=new
WashingNachine(),wm.switchOn(),int
numOFClothes=wm.acceptClothes(),wm.acceptDetergent(),wm.switchOff(),System.out.
println(numOFClothes+" clothes get washed"),}}

.

2)Create a calculator class which will have methods add, multiply, divide S subtract

class Calculation{public int add(inta,int b){return a+b,}public int subtract(inta,int
b){if(a>b){return ab,}else{return ba,}}public int multiply(inta,int b){return
a*b,}public int divide(inta,int b){if(a>b){return a/b,}else{return b/a,}}}public class
Calculator{public static void main(String |]args){Calculation cal=new Calculation(),int
add=cal.add(S,10),int sub=cal.subtract(S,10),intmul=cal.multiply(S,10),int
div=cal.divide(S,10),System.out.println(add),System.out.println(sub),System.out.println
(mul),System.out.println(div),}}
3. Create a class called Student which has the following methods:

i. Average: which would accept marks of 3 examinations S return whether the student
haspassed or failed depending on whether he has scored an average above S0 or not.ii.
!nputname: which would accept the name of the student S returns the name.
import java.util.*, public class Student{ Scanner input=new Scanner(System.in), public
String average(){System.out.print("Enter Narks1: "),double
m1=input.nextDouble(),System.out.print("Enter Narks2: "),double
m2=input.nextDouble(),System.out.print("Enter Narks3: "),double
m3=input.nextDouble(),double tm=m1+m2+m3,double avg=tm/3,if(avg<S0){return
"Failed",}if(avg>S0){return "Passed",}return " ",}public String
getName(){System.out.println("Enter Name:"),String name=input.nextLine(),String
result=average(),return name+" get "+result,}public static void
main(String|]args){Student data=new Student(),String
nameAndResut=data.getName(),System.out.println(nameAndResut),}}


4).Create a Bank class with methods deposit S withdraw. The deposit method would
acceptattributes amount S balance S returns the new balance which is the sum of
amount Sbalance. Similarly, the withdraw method would accept the attributes amount
S balance Sreturns the new balance balance amount if balance > = amount or return 0
otherwise.

import javax.swing.*,class Customer{intbal, Customer(intbal) {this.bal = bal,}int
deposit(intamt) {if (amt< 0) {System.out.println("!nvalid Amount"),return 1,}bal = bal
+ amt,return 0,} int withdraw(intamt) {if (bal<amt) {System.out.println("Not sufficient
balance."),return 1,}if (amt< 0) {System.out.println("!nvalid Amount"),return 1,}bal =
bal amt,return 0,}void check() {]OptionPane.showNessageDialog(null,"Balance:" +
!nteger.toString(bal)),} }public class Bank{public static void
main(String|]args){Customer Cust=new Customer(1S00),String
st1=]OptionPane.show!nputDialog(null,"Enter the amount to
deposit:"),intdep=!nteger.parse!nt(st1),

int bal1=Cust.deposit(dep),Cust.check(),String
st2=]OptionPane.show!nputDialog(null,"Enter the amount to withdraw:"),int
with=!nteger.parse!nt(st2),intbal2=Cust.withdraw(with),Cust.check(),}}

int bal1=Cust.deposit(dep),Cust.check(),String
st2=]OptionPane.show!nputDialog(null,"Enter the amount to withdraw:"),int
with=!nteger.parse!nt(st2),intbal2=Cust.withdraw(with),Cust.check(),}}

S)Create an Employee class which has methods netSalary which would accept salary S
tax asargumentsS returns the netSalary which is tax deducted from the salary. Also it
has a methodgrade which would accept the grade of the employee S return grade.

import java.util.*,class Employee{static Scanner input=new Scanner(System.in),public
double netSalary(double salary, double taxrate){double
tax=salary*taxrate,doublenetpay=salary=tax,returnnetpay,}public static String grade(
){System.out.print("Enter Crade: "),String grade=input.next(),return grade,}public
static void main(String|] args){Employee emp=new Employee(),System.out.print("Enter
Salary: "),double sal=input.nextDouble(),System.out.print("Enter Tax in %: "),double
taxrate=input.nextDouble()/100, String g=emp.grade(),double
net=emp.netSalary(sal,taxrate),System.out.println("Net Salary is:
"+net),System.out.println("Crade is: "+g),}}
6. Create Product having following attributes: Product !D, Name, Category !D and
UnitPrice. CreateElectricalProduct having the following additional attributes:
voltageRange and Wattage. Add a
behavior to change the Wattage and price of the electrical product. Display the
updatedElectricalProduct details.
import java.util.*,class
Product{intproduct!D,Stringname,intcategory!D,doubleprice,Product(intproduct!D,Strin
gname,intcategory!D,double
price){this.product!D=product!D,this.name=name,this.category!D=category!D,this.pric
e=price,}}public class ElectricalProduct extends
Product{intvoltageRange,intwattage,ElectricalProduct(intproduct!D,Stringname,intcateg
ory!D,doubleprice,intvoltageRange,
intwattage){super(product!D,name,category!D,price),this.voltageRange=voltageRange,
this.wattage=wattage,}

CONNUN!CAT!ON ASS!CNNENT:
1. !dentify the sounds in the following words. How many sounds can you find in each
word? Try and rewrite the words using the phonetic symbols.

S.No. Word Phonetic symbol No. of sounds

1) added d d 4
2) project p r d k t 7
3) man m n 3
4) king k 3
S) duck d k 3
6) come k m 3
7) here h r 3
8) chocolate t k l t 6
3) comfortable k m f r t b l 11
10) environment n v a j r n m n t 12
11) technology t k n l d i 3
12) bear b r 3
13) computer k m p j u t r 3
14) English g l 6
1S) Nanager m n d r 7


2. What do you understand by the term schwa? Explain what you have understood with
the help of examples.

Schwa is the most common sound in the English language. !t occurs only in unstressed
syllables and getting it correct helps spoken English to sound more natural and fluent.
Any vowel letter can be pronounced as schwa and the pronunciation of a vowel letter
can change depending on whether the syllable in which it occurs is stressed or not.

The phonetic symbol for schwa is: /e/

Example:

: To survive the cold weather you have to make thorough preparations..

The schwa sounds are marked in underlined


3. How many sounds do we have in English?

There are 26 letters in the English alphabet but there are 44 sounds in the English
language. This means that the number of sounds in a word is not always the same as
the number of letters.

The sounds are organized into the following different groups:

Short vowels

Long vowels

Diphthongs (double vowel sounds)

voiceless consonants

voiced consonants

Other consonants

4. 'Put' and 'Cut' are spelt in a similar fashion but pronounced differently. Could you
explain why?

Words rhyme when their sounds are the same from the last stressed vowel sound to
the end of the word.
!n singlesyllable words it's easy to find rhymes. Cat, sat, hat, and fat all rhyme.
There are some nonrhyming words, specifically about words you would expect to
rhyme, but do not.

Example: Cut and Put
These two words have some similar spelling but they are pronounced in a different
way.

Cut is pronounced as /kt/
Put is pronounced as /pt/


S. Could you explain connected speech?

When we speak naturally we do not pronounce a word, stop, and then say the next
word in the sentence. Fluent speech flows with a rhythm and the words bump into each
other. To make speech flow smoothly the way we pronounce the end and beginning of
some words can change depending on the sounds at the beginning and end of those
words.
These changes are described as features of connected speech.

Sounds twinning (gemination)

When a word ends in a consonant sound and the following word begins with the same
consonant sound, we don't pronounce two sounds both sounds are pronounced
together as one.

!'m a bit tired
We have a lot to do
Tell me what to say
She's slept for three hours
!'ve finished

Sounds disappear (elision)

When the sounds /t/ or /d/ occur between two consonant sounds, they will often
disappear completely from the pronunciation.

!'m going nex(t) week
That was the wors(t) job ! ever had!
]us(t) one person came to the party!
! can'(t) swim

6. Why does 'Who is' sound as who(w)iz is connected speech?

When one word ends with a vowel sound and the next word begins with a vowel,
another sound, a /w/ or /j/ can be added depending on the particular sounds to make a
smooth transition. This is a type of linking (vowel to vowel Linking).

Here, in this example, 'who' ends with vowel sound and 'is' begins with a vowel sound.
So, the sound /w/ is added to make a smooth transition.


7. Why does visit us sound as 'visi tas'?

When one word ends with a consonant sound and the next word begins with a vowel
sound there is a smooth link between the two. This type is known as consonant to
vowel linking.
Here,
'visit' ends with consonant sound and 'us' begins with a vowel sound. So, there is a
smooth link between these two words

8. Based on the lessons you have accessed, write a brief note on what you have
understood about pronunciation in English.

There are 26 letters in the English alphabet but there are many more sounds in the
English language. This means that the number of sounds in a word is not always the
same as the number of letters.

The word 'CAT' has three letters and three sounds but the word 'CATCH' has five letters
but still only three sounds.
!f we write these words using sound symbols, we can see exactly how many sounds
they have.

CAT is written /k t/
CATCH is written /k /


3. What is linking /r/?

!n standard British English the letter 'r' after a vowel sound at the end of word is often
not pronounced. However, when the following word begins with a vowel the /r/ sound
is pronounced to make a smooth link. This is linking /r/.

An Example is:
ca(r) (no r in pronunciation)
The car is here (r is pronounced and links to the following word)


10. What are voiceless and voiced sounds? Please explain this with the help of
examples.

!n English, some consonants are voiced like /v/ and some are voiceless like /f/.
You can't see the difference, you might be able to hear the difference, but you can
definitely feel the difference.

When making voiced sounds, throat vibrates
When making voiceless sounds, it's just air coming through the mouth.

For Example,
1. van and Fan
2. Pull and Bull
3. Tin and Din

The following sounds are usually voiceless:
p t k f

The following sounds are usually voiced

b d g v

BAS!CS OF PROCRANN!NC ASS!CNNENT:
1. *Write a program to accept an array of names and a name and check whether the
name
2. is present in the array. Return the count of occurrence. Use the following array as
input
3. {Dave", Ann", Ceorge", Sam", Ted", Cag", Saj", Agati", Nary", Sam",
4. Ayan", Dev", Kity", Neery", Smith", ]ohnson", Bill", Williams", ]ones",
S. Brown", Davis", Niller", Wilson", Noore", Taylor, Anderson", Thomas",
6. ]ackson"}*/
7.
8.
3. import java.io.*,
10. import java.util.StringTokenizer,
11.
12. public class CountOccurance
13. {
14. public static void main(String args|])throws Exception
1S. {
16. !nputStreamReader isr=new !nputStreamReader(System.in),
17. BufferedReader br=new BufferedReader(isr),
18.
13. System.out.println("ENTER ARRAY OF NANES:"),
20. String arrNames=br.readLine(),
21.
22. StringTokenizer st1=new StringTokenizer(arrNames),
23.
24. System.out.println("ENTER THE NANE TO BE SEARCHED:"),
2S. String name=br.readLine(),
26.
27. int countNoOccurance=0,
28.
23. while(st1.hasNoreTokens())
30. {
31. if(name.equals!gnoreCase(st1.nextToken()))
32. {
33. countNoOccurance++,
34.
3S. }
36. }
37.
38. System.out.println("THE NANE "+name+" HAS BEEN APPEARED
"+countNoOccurance+" NO. OF

2) write a program to calculate gcd of two numbers
#include <iostream>
02 using namespace std,
03
04 int gcd(int, int),
0S int CCD(int a, int B),
06
07 int main()
08 {
03 int num1, num2,
10
11 //get two numbers
12 cout << "Please enter two positive integers seperated by a comma: ",
13 cin >> num1 >> num2,
14 while ((num1 < 0) ]] (num2 < 0))
1S {
16 cout << "Please enter two positive integers: ",
17 cin >> num1 >> num2,
18 }
13
20 //Display CCD of two numbers.
21 cout << "The greatest common divisor of " << num1,
22 cout << " and " << num2 << " is ",
23 cout << gcd(num1, num2) << endl,
24 system("pause"),
2S return 0,
26 }
27
28 // Recursive call to function
23 int gcd(int x, int y)
30 {
31 if (x % y == 0)
32 return y,
33 else
34 return gcd(y, x % y),
3S }
36
37
38 // !terative call to function
33 int CCD(int a, int B)
40 {
41 while (1)
42 {
43 a = a % b,
44 if ( a == 0)
4S {
46 return b,
47 }
48 b = b % a,
43 if (b == 0)
S0 {
S1 return a,
S2 }

Vous aimerez peut-être aussi