CSE 012 EXAM WITH COMPLETE SOLUTIONS
Basic instruction types are input, process, and _____.
a. output
b. memory
c. calculation
d. assignment - ANSWER a. output
In an instruction like: z = x + y, the symbols x, y, and z are examples of _____.
a. output
b. visibles
c. variables
d. instructions - ANSWER c. variables
Consider the following program:
t = 15
t=t*2
t=t+1
t=t-4
put t
What does the program produce as output?
,a. 11
b. 27
c. 12
d. 15 - ANSWER b. 27
Which symbol represents the multiplication operation in programming?
a. .
b. *
c. x
d. ( ) - ANSWER b. *
A sequence of instructions that solves a problem is called _____.
a. an algorithm
b. a process
c. an allegory
d. turtle graphics - ANSWER a. an algorithm
What is a common word for the textual representation of a program?
a. code
b. prompt
c. interpreter
d. expression - ANSWER a. code
Which instruction displays variables or expression values?
,a. put()
b. print()
c. output()
d. display() - ANSWER b. print()
Which symbol is used in Python to create a comment?
a. *
b. C
c. //
d. # - ANSWER d. #
Which code example is an expression?
a. x = 4
b. print(x)
c. (x * y) / 2
d. # Display x - ANSWER c. (x * y) / 2
Which statement outputs the text: "I won't quit!"?
a. print(I won't quit!)
b. print("I won't quit!")
c. print('I won't quit!')
d. print('I won't quit!', punctuation=True) - ANSWER b. print("I won't quit!")
, Space, tab, and newline are all called _____ characters.
a. noprint
b. symbol
c. space-line
d. whitespace - ANSWER d. whitespace
Which statement does not print a newline character at the end?
a. print('First part...')
b. print('First part...\n')
c. print('First part...', end='')
d. print('First part...', end="-\n") - ANSWER c. print('First part...', end='')
Which statement reads a user-entered string into variable user_name?
a. input = user_name()
b. user_name = input()
c. input() => user_name
d. user_name = "input()" - ANSWER b. user_name = input()
Which function converts a string to an integer?
a. int()
b. integer()
c. string_to_int()
d. convert(string, int) - ANSWER a. int()
Basic instruction types are input, process, and _____.
a. output
b. memory
c. calculation
d. assignment - ANSWER a. output
In an instruction like: z = x + y, the symbols x, y, and z are examples of _____.
a. output
b. visibles
c. variables
d. instructions - ANSWER c. variables
Consider the following program:
t = 15
t=t*2
t=t+1
t=t-4
put t
What does the program produce as output?
,a. 11
b. 27
c. 12
d. 15 - ANSWER b. 27
Which symbol represents the multiplication operation in programming?
a. .
b. *
c. x
d. ( ) - ANSWER b. *
A sequence of instructions that solves a problem is called _____.
a. an algorithm
b. a process
c. an allegory
d. turtle graphics - ANSWER a. an algorithm
What is a common word for the textual representation of a program?
a. code
b. prompt
c. interpreter
d. expression - ANSWER a. code
Which instruction displays variables or expression values?
,a. put()
b. print()
c. output()
d. display() - ANSWER b. print()
Which symbol is used in Python to create a comment?
a. *
b. C
c. //
d. # - ANSWER d. #
Which code example is an expression?
a. x = 4
b. print(x)
c. (x * y) / 2
d. # Display x - ANSWER c. (x * y) / 2
Which statement outputs the text: "I won't quit!"?
a. print(I won't quit!)
b. print("I won't quit!")
c. print('I won't quit!')
d. print('I won't quit!', punctuation=True) - ANSWER b. print("I won't quit!")
, Space, tab, and newline are all called _____ characters.
a. noprint
b. symbol
c. space-line
d. whitespace - ANSWER d. whitespace
Which statement does not print a newline character at the end?
a. print('First part...')
b. print('First part...\n')
c. print('First part...', end='')
d. print('First part...', end="-\n") - ANSWER c. print('First part...', end='')
Which statement reads a user-entered string into variable user_name?
a. input = user_name()
b. user_name = input()
c. input() => user_name
d. user_name = "input()" - ANSWER b. user_name = input()
Which function converts a string to an integer?
a. int()
b. integer()
c. string_to_int()
d. convert(string, int) - ANSWER a. int()