


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Programming Fundamentals 01 UPDATED REVIEW
Typology: Quizzes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



"What is the primary goal of computer science?" "The primary goal of computer science is problem-solving using computers."
"Define program in the context of computer science." "A program is a sequence of instructions that specifies how to perform a computation."
"What are the basic elements of programs?" "Basic elements include input, output, math, conditional execution, and repetition."
"Describe the process of compiling a program." "Compiling is the process of translating a program written in a high-level programming language into machine code that can be executed by a computer."
"Explain what an interpreter is." "An interpreter is a program that reads and executes code directly, translating each statement into a sequence of one or more subroutines and then into machine code."
"What is a syntax error?" "A syntax error occurs when the program does not follow the rules of the programming language, making it impossible to compile or interpret."
"What is a runtime error?" "A runtime error occurs during the execution of a program, causing it to terminate unexpectedly."
"What is a semantic error?" "A semantic error is a mistake in a program's logic that results in incorrect behavior or output, even though the program compiles and runs."
"What does it mean to debug a program?" "Debugging is the process of finding and fixing errors or bugs in a program's source code."
"What type of value does the expression 4/2 produce in Python 3?"
"A floating-point number (2.0)."
"How do you create a variable x and assign it the value 100 in Python?"
"x = 100"
"What is the result of the expression 2 + 3 * 4 in Python?" "14, because multiplication has higher precedence than addition."
"In Python what symbol is used for exponentiation as in ' raised to the power of 3'?"
"* so 2 * 3 equals 8."
"What does the % operator do in Python?" "It computes the remainder of dividing the first number by the second, known as the modulus operator."
"How does Python handle integer division with the // operator?"
"It performs floor division, discarding any fractional part of the result."
"What is the value of 1 + 2 * 3 - 4 / 2 in Python?" "5.0 because the operations are performed with precedence: multiplication and division before addition and subtraction. BIDMAS"
"What is a string in Python and how can you create one?", "A string is a sequence of characters created by enclosing text in quotes, like 'hello'."
"What does the expression 'Hi' * 3 produce in Python?" "'HiHiHi' because the * operator repeats the string."
"What does the expression len('hello') return in Python?" "5 because len() returns the number of characters in a string."
"What is the output of print('Hello' + 'World') in Python?" "The concatenated string 'HelloWorld'."
"How can you convert the integer 123 to a string in Python?"
"Using the str() function, as in str(123)."
"What Python function can you use to get the absolute value of a number?"
"The abs() function so abs(-5) returns 5."
"How do you check the type of a variable x in Python?" "Using the type() function, as in type(x)."
"In Python what is the difference between = and ==?" "= is the assignment operator and == is the equality comparison operator."
"What does the expression 3 != 4 evaluate to in Python?" "True, because 3 is not equal to 4."
"How do you express a Boolean 'OR' condition in Python?"
"Using the or keyword as in True or False."
"What does the input() function do in Python?" "It reads a line from input converts it to a string and returns it."
"How can you make a multi-line comment in Python?" "Using triple quotes, either ''' or """, at the start and end of the comment."
"What is the result of the expression '12'.isdigit() in Python?"
"True because all characters in the string '12' are digits."
"What does the split() method do when applied to a string 'a
b,c' in Python?", "It splits the string into a list of elements based on a delimiter, resulting in ['a', 'b', 'c'] when using a comma as the delimiter."
"How do you replace 'world' with 'Python' in the string 'Hello world' in Python?"
"Using the .replace() method, like 'Hello world'.replace('world', 'Python'), which results in 'Hello Python'."