PCEP-30-02 Exam Questions
392 real PCEP-30-02 exam questions with expert-verified answers and explanations. Page 6 of 8.
- Question #251
The following code: print(float("1", "3"))
- Question #252
The following code reads two numbers. Which of the following is the correct input for the code? 1 x, y = eval(input('Enter two numbers: ')) 2 print(x) 3 print(y)
- Question #253
The value thirty point eleven times ten raised to the power of nine should be written as:
- Question #254
What is the expected output of the following code? 1 z = y = x = 1 2 print(x, y, z, sep='')
- Question #255
Consider the following code snippet: 1 w = bool(23) 2 x = bool('') 3 y = bool(' ') 4 z = bool([False]) Which of the variables will contain False?
- Question #256
Strings in Python are delimited with:
- Question #257
The 0o prefix means that the number after it is denoted as:
- Question #258
How many arguments can the print() function take?
- Question #259
You want to print the sum of two number. What snippet would you insert in the line indicated below: 1 x = input('Enter the first number: ') 2 y = input('Enter the second number: ')...
- Question #260
If you want to build a string that reads: Peter's sister's name's "Anna" Which of the following literals would you use? (Choose two.)
- Question #261
You want to write a program that asks the user for a value. For the rest of the program you need a whole number, even if the user enters a decimal value. What would you have to wri...
- Question #262
Which of the following statements can be used to return the length of the given string str?
- Question #263
What is the expected output of the following code if the user enters 2 and 4? ```python x = int(input()) y = int(input()) print(x + y) ```
- Question #264
Consider the following Python code: ```python name = 'Peter' age = 23 flag = True ``` What are the types of the variables name, age and ag?
- Question #265
You want to print each name of the list on a new line. `data = ['Peter', 'Paul', 'Mary', 'Jane']` Which statement will you use?
- Question #266
What is the expected output of the following code? ```python print(type(1J)) ```
- Question #267
You are an intern for ABC electric cars company. You must create a function that calculates the average velocity of their vehicles on a 1320 foot (1/4 mile) track. Consider the fol...
- Question #268
What is the result of the following code? ```python x = (3, ) print(len(x)) ```
- Question #269
The most important difference between integer and floating-point numbers lies in the fact that:
- Question #270
What is the expected output of the following code? ```python print(ord('c')?ord('a')) ```
- Question #271
Consider the following python code: ```python x1 = '23' y1 = 7 z1 = x1 * y1 x2 = 42 y2 = 7 z2 = x2 / y2 x3 = 4.7 y3 = 1 z3 = x3 / y3 ``` What are the data types of the variables z1...
- Question #272
What is the expected output of the following code? ```python print(chr(ord('p') + 3)) ```
- Question #273
Which of the following operators can be used with strings? ``` 1) + 2) * 3) - 4) in ```
- Question #274
The user enters 123. Which of the following code snippets will print 124 to the monitor? (Choose three.)
- Question #275
Which of the following is the output of the below Python code? ```python str = 'Hello World' print(str[::-1]) ```
- Question #276
What is the expected output of the following code if the user enters 3 and 2? ```python x = int(input()) y = int(input()) x = x % y x = x % y y = y % x print(y) ```
- Question #277
You want the name the user puts in to be written back to the monitor. What snippet would you insert in the line indicated below: print('Enter Your Name: ') # insert your code here...
- Question #278
What is the expected output of the following code? print(type(+1E10)) print(type(5.0)) print(type('True')) print(type(False))
- Question #279
What is the expected output of the following code? print(not 0) print(not 23) print(not '') print(not 'Peter') print(not None)
- Question #280
What is the expected output of the following code? data = 'abbabadaadbaccabc' print(data.count('ab', 1))
- Question #281
What is the expected output of the following code? print(chr(ord('z') - 2))
- Question #282
What is the expected output of the following code? print('Peter ' 'Wellert')
- Question #283
What is the expected output of the following code? print ('oat ('*1.3))
- Question #284
What is the decimal value of the following binary number?
- Question #285
What is the expected output of the following code? x = 1 if x > 0 or x < 1: print("1") if x > 1: print("2") elif x >= 1: print("3") else: print("4")
- Question #286
What is the expected output of the following code? def func(text, num): while num > 0: print(text) num = num - 1 func('Hello', 3)
- Question #287
What is the expected output of the following code? x = True y = False z = False if not x or y: print(1) elif not x or not y and z: print(2) elif not x or y or not y and x: print(3)...
- Question #288
How many stars will the following snippet print to the monitor? i = 4 while i > 0: i -= 2 print('*') if i == 2: break else: print('*')
- Question #289
The ABC organiza a company needs a simple program that their call center will use to enter survey data for a new coffee variety. The program must accept input and return the averag...
- Question #290
How many stars will the following code print to the monitor? ```python 1 i = 0 2 while i <= 3: 3 print('*') 4 i += 2 ```
- Question #291
What is the expected output of the following code? ```python 1 x = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] 2 3 def func(data): 4 res = data[0][0] 5 for d in data: 6 for d in data: 7 i...
- Question #292
Which of the following for loops would output the below number pattern? ``` 11111 22222 33333 44444 55555 ```
- Question #293
What is the expected output of the following code? ```python 1 def func(x): 2 return 1 if x % 2 != 0 else 2 3 4 print(func(func(1))) ```
- Question #294
Consider the following code. Why is it not working? ```python 1 room = input('Enter the room number: ') 2 rooms = {101: 'Gathering Place', 102: 'Meeting Room'} 3 if not room in roo...
- Question #295
What will happen when you attempt to run the following code? ```python 1 while True: 2 print("1") ```
- Question #296
You are creating a Python script to evaluate input and check for upper and lower case. Code segment 1: `if name.upper() == name: else: print(name, 'is mixed case.')` Code segment 2...
- Question #297
Analyze the following code fragments that assign a boolean value to the variable even? Code-1: ```python 1 num = 42 2 3 # Code-1 4 if num % 2 == 0: 5 even = True 6 else: 7 even = F...
- Question #298
order = int(input('Please enter the order value: ')) state = input('Please enter the state (as postal abbreviation): ') delivery = 0 if state in ['NC', 'SC', 'VA']: if order <= 100...
- Question #299
Which of the code snippet below will print the following to the monitor? Paul Mary Jane
- Question #300
What is the expected output of the following code? data = [[42, 17, 23, 13], [11, 9, 3, 7]] res = data[0][0] for da in data: for d in da: if res > d: res = d print(res)