PLD MIDTERMS

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/45

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

46 Terms

1
New cards

Those who are using Python programming are called as:
A. Python Café
B. Python Forest
C. Pythonistas
D. Monty Python’s Flying Circus

C. Pythonistas

2
New cards

A complete set of commands is known as:
A. Instruction list
B. Code laws
C. Command line
D. Command list

D. Command list

3
New cards

Which of the following are the correct statements?
A. True + 1 evaluates to 2
B. True and False evaluates to False
C. True or False evaluates to False
D. 7 + False evaluates to False

A. True + 1 evaluates to 2
B. True and False evaluates to False

4
New cards

Who created Python?
A. Guido ban Rossum
B. Guido van Rossum
C. Guido the Russian
D. Guodo van Rossum

B. Guido van Rossum

5
New cards

Python is known as:
A. A compiled language
B. An interpreted language
C. A machine language
D. An assembly language

B. An interpreted language

6
New cards

Which of the following is a valid Python comment?
A. <!-- comment -->
B. /* comment */
C. # comment
D. // comment

C. # comment

7
New cards

Python is a:
A. Low-level language
B. High-level language
C. Middle-level language
D. Machine-level language

B. High-level language

8
New cards
  1. What will be the output of the following pseudocode:

Initialize x as 10;
If x is of type int,
   print "Integer"
else
   print "Not Integer"

A. Integer
B. Not Integer
C. Error
D. None

A. Integer

9
New cards

What will be the output of:
print("Python", "Programming", sep="-")
A. Python-Programming
B. Python Programming
C. PythonProgramming
D. Python,Programming

A. Python-Programming

10
New cards

What is the output of:

print("Hello", end='@');
print("World")

A. HelloWorld
B. Hello@World
C. Hello World
D. Hello@ Wo

B. Hello@World

11
New cards

Pseudocode:
Ask user for number, multiply by 2, print result
A. Reads number, prints double
B. Reads string, prints same
C. Error in input
D. No output

A. Reads number, prints double

12
New cards

Identify the error:
print("Hello World"))
A. Missing quotation marks
B. Extra parenthesis
C. Missing parenthesis
D. No error

B. Extra parenthesis

13
New cards

Find the mistake:

user_input = input("Enter a number: ")
print("You entered:", int(user_input))

A. Syntax error
B. No error
C. int() should be str()
D. input() function used incorrectly

C. int() should be str()

14
New cards
  1. Pseudocode:

Set x = 10
While x > 0,
   decrement x by 1
   print x

A. Prints numbers from 10 to 1
B. Prints numbers from 1 to 10
C. Prints numbers from 9 to 0
D. Infinite loop

C. Prints numbers from 9 to 0

15
New cards

Pseudocode:
For numbers 1 to 5, print number if it’s odd
A. Prints 1 3 5
B. Prints 2 4
C. Prints all numbers 1 to 5
D. No output

A. Prints 1 3 5

16
New cards

Which of the following codes is correct?
A. print("Programming is fun") print("Python") print("Computer Engineering")

B. print("Programming is fun") print("Python") print("Computer Engineering")

C. print("Programming is fun") print("Python") print("Computer Engineering")

D. print("Programming is fun") print("Python") print("Computer Engineering")

All of the above

17
New cards

What function do you use to read a string?

A. input("Enter a string")

B. eval(input("Enter a string"))

C. center("Enter a string")

D. eval("Enter a string")

A. input("Enter a string")

18
New cards

If you enter 1, 2, 3 in three separate lines, what will be displayed by this program?

number1 = input()
number2 = input()
number3 = input()
average = (number1 + number2 + number3) / 3
print(average)

A. 1.0
B. 2.0
C. 3.0
D. Runtime error

D. Runtime error

19
New cards

You can place the line continuation symbol ___ at the end of a line to tell the interpreter the statement is continued on the next line.
A. /
B. \
C. #
D. &

B. \

20
New cards

Which of the following is a valid identifier?
A. $343
B. mile
C. 9X
D. 8+9

B. mile

21
New cards

Which of the following statements are the same?
A. x -= x + 4

B. x = x + 4 - x

C. x = x - (x + 4)

A. A and B
B. A and C
C. B and C
D. All of the above

B. A and C

22
New cards

What is x if x = 1
y = 2

x *= y + 1?

A. x is 1

B. x is 2

C. x is 3

D. x is 4

C. x is 3

23
New cards

Which of the following symbols are used for paragraph commenting?
A. “”
B. /* */
C. ‘‘‘
D. #

C. ‘‘‘

24
New cards

Which of the following is a valid file extension of a Python source code program?
A. .cpp
B. .c
C. .py
D. .obj

25
New cards
<p>What will be the printed value of Y if A = 12?<br>A. 10<br>B. 20<br>C. 30<br>D. 40</p>

What will be the printed value of Y if A = 12?
A. 10
B. 20
C. 30
D. 40

A. 10

26
New cards
<p>What will be the printed value of Y if A = 3?<br>A. -1<br>B. -2<br>C. -4<br>D. -5<br></p>

What will be the printed value of Y if A = 3?
A. -1
B. -2
C. -4
D. -5

27
New cards
<p>What will be the printed value of Y if A = -4?<br>A. -18<br>B. -4<br>C. -15<br>D. -10<br></p>

What will be the printed value of Y if A = -4?
A. -18
B. -4
C. -15
D. -10

28
New cards
<p>What will be the printed value of Y if A = 10?<br>A. 10<br>B. 20<br>C. 30<br>D. 40<br></p>

What will be the printed value of Y if A = 10?
A. 10
B. 20
C. 30
D. 40

29
New cards

What is the output of the following code:

print(0.3 + 0.5 == 0.8)

A. True

B. False

C. Error

D. Machine dependent

30
New cards

Why do computers use zeros and ones?
A. Because combinations of zeros and ones can represent any number
B. Because digital devices have two states
C. Because binary numbers are simplest
D. Because binary numbers are the base of all systems

31
New cards

_______ is the physical aspect of the computer that can be seen.
A. Hardware
B. Software
C. Operating system
D. Application program

32
New cards

Computer can execute the code in:
A. Machine language
B. Assembly language
C. High-level language
D. None of the above

33
New cards

_______ translates high-level language program into machine language program.
A. An assembler
B. A compiler
C. CPU
D. The operating system

34
New cards

Which of the following statements is true?
A. Python 3 is backward compatible with Python 2
B. Python 3 is not backward compatible with Python 2
C. Python 2 programs always run on Python 3
D. Python 3 programs always run on Python 2

35
New cards

In Python, a syntax error is detected by the:
A. Compiler at compile time
B. Interpreter at runtime
C. Compiler at runtime
D. Interpreter at compile time

36
New cards

_______ is the code in natural language mixed with some program code.
A. Python program
B. Python statement
C. Pseudocode
D. Flowchart diagram

37
New cards

What is displayed in the following code?

x = 1
y = x + 1
print("y is", y)

A. y is 0
B. y is 1
C. y is 2
D. Error

38
New cards

If a number is too large to be stored in memory, it:
A. Causes overflow
B. Causes underflow
C. Causes no error
D. Cannot happen in Python

39
New cards

What is the result of evaluating 2 + 2 ** 3 / 2?
A. 4.0
B. 6.0
C. 7.5
D. 8.0

40
New cards
  1. What is the value of i printed?

j = 1
i = j + 5
print("What is i?", i)

A. 0
B. 5
C. 6
D. 7

41
New cards

Which type of programming does Python support?
A. Object-oriented programming
B. Structured programming
C. Functional programming
D. All of the mentioned

42
New cards

Which of the following is used to define a block of code in Python?
A. Indentation
B. Key
C. Brackets
D. All of the mentioned

43
New cards

Which of the following characters represent exponentiation in Python?
A. ^
B. %
C. **
D. $

44
New cards
<p>44. How many times will the string “Yoyo” be printed if the value of X is 8?<br>A. 6<br>B. 7<br>C. 8<br>D. 10</p>

44. How many times will the string “Yoyo” be printed if the value of X is 8?
A. 6
B. 7
C. 8
D. 10

B. 7

45
New cards
<p>What will be the value of X so that will make the string “Bye” be displayed?<br>A. X is equal to zero (0)<br>B. X is an even nymber<br>C. X is an odd number<br>D. X is negative value<br></p>

What will be the value of X so that will make the string “Bye” be displayed?
A. X is equal to zero (0)
B. X is an even nymber
C. X is an odd number
D. X is negative value

A. X is equal to zero (0)

46
New cards
<p><mark data-color="#ffffff" style="background-color: rgb(255, 255, 255); color: inherit;">How many times will the string “Yoyo” be printed if the value of X = 10?<br>A. 1<br>B. 3<br>C. 7<br>D. 5</mark><br></p>

How many times will the string “Yoyo” be printed if the value of X = 10?
A. 1
B. 3
C. 7
D. 5

9 times