O level programming Flashcards
(40 cards)
What is a variable in programming?
A variable is a named storage location in memory that holds a value.
What is the purpose of a loop in programming?
A loop is used to repeat a block of code until a certain condition is met.
What is an algorithm?
An algorithm is a step-by-step procedure or formula for solving a problem.
What is the difference between a compiler and an interpreter?
A compiler translates the entire source code into machine code before execution, while an interpreter translates and executes the code line by line.
What is a function in programming?
A function is a block of code that performs a specific task and can be reused throughout a program.
What is a conditional statement in programming?
A conditional statement is a control structure that executes different actions based on whether a condition is true or false.
What is the purpose of an array in programming?
An array is used to store multiple values of the same data type under a single name.
What does the term ‘syntax error’ refer to in programming?
A syntax error is a type of error that occurs when the rules of a programming language are not followed.
What is a data type in programming?
A data type is a classification of data that specifies which operations can be performed on it.
What is the purpose of a comment in programming?
A comment is used to add notes or explanations to code for documentation purposes and is ignored by the compiler or interpreter.
What is the difference between local and global variables?
Local variables are declared within a specific block of code and can only be accessed within that block, while global variables are declared outside of any block and can be accessed throughout the program.
What is the purpose of a switch statement in programming?
A switch statement is used to execute different blocks of code based on the value of an expression.
What is the difference between ‘==’ and ‘=’ in programming?
’==’ is used to compare two values for equality, while ‘=’ is used to assign a value to a variable.
What is a pointer in programming?
A pointer is a variable that stores the memory address of another variable.
What is the purpose of a while loop in programming?
A while loop is used to repeatedly execute a block of code as long as a specified condition is true.
What is the difference between ‘&&’ and ‘||’ in programming?
‘&&’ is the logical AND operator that returns true if both conditions are true, while ‘||’ is the logical OR operator that returns true if at least one condition is true.
What is the purpose of a for loop in programming?
A for loop is used to iterate over a sequence of values for a specified number of times.
What is the purpose of a break statement in programming?
A break statement is used to exit a loop or switch statement prematurely.
What is the purpose of a continue statement in programming?
A continue statement is used to skip the current iteration of a loop and proceed to the next iteration.
What is a constant in programming?
A constant is a value that cannot be altered or modified during program execution.
What is the purpose of a do-while loop in programming?
A do-while loop is used to execute a block of code at least once, then repeatedly execute it based on a specified condition.
What is the purpose of a function prototype in programming?
A function prototype declares the function’s name, return type, and parameters before the actual function definition.
What is recursion in programming?
Recursion is a technique where a function calls itself to solve a smaller instance of the same problem.
What is a two-dimensional array in programming?
A two-dimensional array is an array of arrays, where each element is itself an array.