PCEP-30-02 PCEP – Certified Entry-Level Python Programmer Dumps

Page 1

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully 1/7 Exam:PCEP-30-02 Title: https://www.passcert.com/PCEP-30-02.html CertifiedEntry-LevelPython Programmer

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

1.Whatarethefourfundamentalelementsthatmakealanguage?

AAnalphabet,phonetics,phonology,andsemantics

B.Analphabet,alexis,phonetics,andsemantics

CAnalphabet,morphology,phonetics,andsemantics

DAnalphabet,alexis,asyntax,andsemantics

Answer:D

Explanation:

Topics:languagealphabetlexissyntaxsemantics Wecansaythateachlanguage(machineornatural,itdoesn'tmatter) consistsofthefollowingelements:

Analphabet:

asetofsymbolsusedtobuildwordsofacertainlanguage(e.g.,theLatinalphabetforEnglish, theCyrillicalphabetforRussian,KanjiforJapanese,andsoon)

Alexis: (akaadictionary)asetofwordsthelanguageoffersitsusers (e.g.,theword"computer"comesfromtheEnglishlanguagedictionary,while"cmoptrue"doesn't; theword"chat"ispresentbothinEnglishandFrenchdictionaries, buttheirmeaningsaredifferent)

Asyntax:

asetofrules(formalorinformal,writtenorfeltintuitively) usedtodetermineifacertainstringofwordsformsavalidsentence (eg,"Iamapython"isasyntacticallycorrectphrase,while"Iapythonam"isn't)

Semantics:

asetofrulesdeterminingifacertainphrasemakessense (eg,"Iateadoughnut"makessense,but"Adoughnutateme"doesn't)

2Whatwillbetheoutputofthefollowingcodesnippet?

Explanation:

2/7
x=1 y=2 z=x x=y y=z print(x,y) A12 B.21 C11 D22
Answer:B
x=1 y=2 z=x
Topic:copyinganimmutableobjectbyassigning Tryityourself:

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

print(z)#1

x=y

print(x)#2

y=z

print(y)#1

print(x,y)#21

Integerisanimmutabledatatype

Thevaluesgetcopiedfromonevariabletoanother Intheendxandychangedtheirvalues

3Pythonisanexampleof: A.amachinelanguage

Bahigh-levelprogramminglanguage

C.anaturallanguage

Answer:B

Explanation:

Topic:high-levelprogramminglanguage https://en.wikipedia.org/wiki/Python(programminglanguage)

4Whatwillbetheoutputofthefollowingcodesnippet?

print(3/5)

A6/10

B06

C0

DNoneoftheabove

Answer:B

Explanation:

Topic:divisionoperator

Tryityourself:

print(3/5)#06

print(4/2)#2.0

Thedivisionoperatordoesitsnormaljob

AndrememberthedivisionoperatorALWAYSreturnsafloat.

5.StringsinPythonaredelimitedwith: Abackslashes(ie,\)

Bdoublequotes(ie,")orsinglequotes(ie,')

Casterisks(ie,*)

Ddollarsymbol(ie,$)

Answer:B

Explanation:

Topics:stringsquotes

Tryityourself:

print("Hello")#Hello

3/7

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

print('World')#World

Unlikeinotherprogramminglanguages,inPythondoublequotesandsinglequotesaresynonymsfor eachother.

Youcanuseeitheroneortheother

Theresultisthesame

6Whatwillhappenwhenyouattempttorunthefollowingcode?

print(Hello,World!)

AThecodewillraisetheSyntaxErrorexception

BThecodewillraisetheTypeErrorexception

CThecodewillraisetheValueErrorexception

D.ThecodewillprintHello,World!totheconsole.

EThecodewillraisetheAttributeErrorexception

Answer:A

Explanation:

Topics:print()SyntaxError

Tryityourself:

#print(Hello,World!)

#SyntaxError:invalidsyntax

Theexclamationmarkmakesitasyntaxerror

7Afunctiondefinitionstartswiththekeyword: Adef

Bfunction

Cfun

Answer:A

Explanation:

Topic:def

Tryityourself:

defmyfirstfunction():

print('Hello')

myfirstfunction()#Hello

https://www.w3schools.com/python/pythonfunctions.asp

8.Assumingthatthetupleisacorrectlycreatedtuple, thefactthattuplesareimmutablemeansthatthefollowinginstruction: mytuple[1]=mytuple[1]+mytuple[0]

Acanbeexecutedifandonlyifthetuplecontainsatleasttwoelements

Bisillegal

Cmaybeillegalifthetuplecontainsstrings

Disfullycorrect

Answer:B

Explanation:

Topics:dictionary

4/7

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

Tryityourself:

mytuple=(1,2,3)

mytuple[1]=mytuple[1]+mytuple[0]

#TypeError:'tuple'objectdoesnotsupportitemassignment Atupleisimmutableandthereforeyoucannot assignanewvaluetooneofitsindexes

9Whatistheexpectedoutputofthefollowingcode?

deffunc(x):

return1ifx%2!=0else2

print(func(func(1)))

A.Thecodeiserroneous.

BNone

C.2

D1

Answer:D

Explanation:

Topics:defconditionalexpression(ifelse)modulusoperator

notequaltooperator

Tryityourself:

deffunc(x):

return1ifx%2!=0else2

print(func(func(1)))#1

print(1%2)#1

print(1%2!=0)#True

Thisisaconditionalexpression

1%2is1andthereforenotequalto0

TheconditionisTrueandtheinnerfunc()functioncallreturns1That1ispassedtotheouterfunction whichwillalsoreturn1

10.Takealookatthesnippet,andchoosethetruestatements:(Selecttwoanswers) nums=[1,2,3]

vals=nums

delvals[1:2]

A.numsislongerthanvals

Bnumsandvalsrefertothesamelist

Cvalsislongerthannums

Dnumsandvalsareofthesamelength

Answer:B,D

Explanation:

Topics:listreferencinglistslicingdel

Tryityourself:

nums=[1,2,3]

vals=nums

5/7

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

delvals[1:2]

print(nums)#[1,3]

print(vals)#[1,3]

Alistisamutabledatatype

Assigningamutabledatatypecreatesareferencetothesameobject valsandnumswillpointtothesameobjectinthememory andwhenyouchangeoneyouautomaticallychangetheother,too

11Whatistheoutputofthefollowingcode?

a=1

b=0

x=aorb

y=not(aandb)

print(x+y)

ATheprogramwillcauseanerror

B.1

CTheoutputcannotbepredicted

D.2

Answer:D

Explanation:

Topics:logicaloperatorsbooleansadditionoperator implicittypecasting

Tryityourself:

a=1

b=0

x=aorb

print(x)#1

print(1or0)#1

y=not(aandb)

print(y)#True

print(1and0)#0

print(not0)#True

print(x+y)#2

print(1+True)#2

IfyoucalculatewithabooleanTruebecomestheinteger1andtherefore1+Trueis2

12Whatistheoutputofthefollowingsnippet?

dct={}

dct['1']=(1,2)

dct['2']=(2,1)

forxindctkeys():

print(dct[x][1],end='')

A21

B(2,1)

6/7

DownloadthelatestPCEP-30-02dumpspdftopassyourexamsuccessfully

C.(1,2)

D12

Answer:A

Explanation:

Topics:dictionarytupleindexingfordictkeys()print()

Tryityourself:

dct={}

dct['1']=(1,2)

dct['2']=(2,1)

print(dct)#{'1':(1,2),'2':(2,1)} forxindctkeys(): print(dct[x][1],end='')#21 print()

print(dct['1'][1])#2 print(dct['2'][1])#1 dct.keys()arethekeys'1'and'2' dct['1'][1]is2and dct['2'][1]is1

13Whatwouldyouinsertinsteadofsothattheprogramchecksforevennumbers? if???:

print('xisanevennumber')

Ax%x==0

Bx%1==2

Cx%2==0

Dx%'even'==True

Ex%2==1

Answer:C

Explanation:

Topics:ifmodulusoperatorequaltooperator

Tryityourself:

x=4

ifx%2==0:

print('xisanevennumber')#xisanevennumber

Everynumberthatdividedbytwodoesnotleavearestiseven.

7/7

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.