Exam GPYC All QuestionsBrowse all questions from this exam
Question 2

What are the contents of the variable x when the following is executed in a Python interactive session?

    Correct Answer: A

    When the expression x.split()[0][1] is evaluated, it first splits the string x into a list of words: ['So', 'you', 'want', 'a', 'GIAC', 'Certification?']. The expression then accesses the first word ('So') and retrieves the second character of that word ('o'). However, the value of x itself does not change due to this operation and remains as 'So you want a GIAC Certification?'. Given the requirement to print the value of x, the value is not altered and remains 'So'.

Discussion
romaeOption: C

Answer is C - since x.split result isn't stored back to x , it prints back original x value So you want a GIAC Certification?

AZIrvThoOption: C

x = "So you want a GIAC Certification?" x.split () [0] [1] print (x) When running this code, it returns "So you want a GIAC Certification?" Answer is C.

mrmrme

Equates to 'o'

kyaoOption: C

My bad. Please ignore my previous answer. It should be C.

kyao

The answer is o

a29dc2cOption: A

split() isn’t stored in x

VenudharOption: C

The option is c