O level programming Flashcards
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.