O level programming Flashcards

1
Q

What is a variable in programming?

A

A variable is a named storage location in memory that holds a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of a loop in programming?

A

A loop is used to repeat a block of code until a certain condition is met.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an algorithm?

A

An algorithm is a step-by-step procedure or formula for solving a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between a compiler and an interpreter?

A

A compiler translates the entire source code into machine code before execution, while an interpreter translates and executes the code line by line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a function in programming?

A

A function is a block of code that performs a specific task and can be reused throughout a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a conditional statement in programming?

A

A conditional statement is a control structure that executes different actions based on whether a condition is true or false.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of an array in programming?

A

An array is used to store multiple values of the same data type under a single name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the term ‘syntax error’ refer to in programming?

A

A syntax error is a type of error that occurs when the rules of a programming language are not followed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a data type in programming?

A

A data type is a classification of data that specifies which operations can be performed on it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of a comment in programming?

A

A comment is used to add notes or explanations to code for documentation purposes and is ignored by the compiler or interpreter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between local and global variables?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of a switch statement in programming?

A

A switch statement is used to execute different blocks of code based on the value of an expression.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the difference between ‘==’ and ‘=’ in programming?

A

’==’ is used to compare two values for equality, while ‘=’ is used to assign a value to a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a pointer in programming?

A

A pointer is a variable that stores the memory address of another variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of a while loop in programming?

A

A while loop is used to repeatedly execute a block of code as long as a specified condition is true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the difference between ‘&&’ and ‘||’ in programming?

A

‘&&’ 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the purpose of a for loop in programming?

A

A for loop is used to iterate over a sequence of values for a specified number of times.

18
Q

What is the purpose of a break statement in programming?

A

A break statement is used to exit a loop or switch statement prematurely.

19
Q

What is the purpose of a continue statement in programming?

A

A continue statement is used to skip the current iteration of a loop and proceed to the next iteration.

20
Q

What is a constant in programming?

A

A constant is a value that cannot be altered or modified during program execution.

21
Q

What is the purpose of a do-while loop in programming?

A

A do-while loop is used to execute a block of code at least once, then repeatedly execute it based on a specified condition.

22
Q

What is the purpose of a function prototype in programming?

A

A function prototype declares the function’s name, return type, and parameters before the actual function definition.

23
Q

What is recursion in programming?

A

Recursion is a technique where a function calls itself to solve a smaller instance of the same problem.

24
Q

What is a two-dimensional array in programming?

A

A two-dimensional array is an array of arrays, where each element is itself an array.

25
Q

What is the purpose of the ‘return’ statement in a function?

A

The ‘return’ statement is used to exit a function and return a value to the calling code.

26
Q

What is a structure in programming?

A

A structure is a user-defined data type that groups related data items of different data types.

27
Q

What is the purpose of a header file in programming?

A

A header file contains declarations of functions, variables, and constants that can be shared across multiple source files.

28
Q

What is the difference between stack and heap memory?

A

Stack memory is used for static memory allocation and is managed by the compiler, while heap memory is used for dynamic memory allocation and must be managed by the programmer.

29
Q

What is the purpose of the ‘sizeof’ operator in programming?

A

The ‘sizeof’ operator returns the size in bytes of a data type or a variable.

30
Q

What is the purpose of a typedef in programming?

A

A typedef creates an alias for an existing data type to make code more readable and maintainable.

31
Q

What is the purpose of a static variable in programming?

A

A static variable retains its value between function calls and is initialized only once.

32
Q

What is the purpose of the ‘extern’ keyword in programming?

A

The ‘extern’ keyword is used to declare a variable or function that is defined in another source file.

33
Q

What is the purpose of the ‘const’ keyword in programming?

A

The ‘const’ keyword is used to declare a variable as read-only, meaning its value cannot be changed.

34
Q

What is a bitwise operator in programming?

A

A bitwise operator performs operations on individual bits of binary numbers.

35
Q

What is the purpose of the ‘union’ keyword in programming?

A

The ‘union’ keyword is used to define a data structure that can hold different data types in the same memory location.

36
Q

What is the purpose of the ‘enum’ keyword in programming?

A

The ‘enum’ keyword is used to define a set of named integer constants.

37
Q

What is the purpose of the ‘continue’ statement in programming?

A

The ‘continue’ statement is used to skip the current iteration of a loop and proceed to the next iteration.

38
Q

What is the purpose of the ‘break’ statement in programming?

A

The ‘break’ statement is used to exit a loop or switch statement prematurely.

39
Q

What is the purpose of the ‘auto’ keyword in programming?

A

The ‘auto’ keyword is used to declare automatic variables that are automatically initialized to garbage values.

40
Q

What is the purpose of the ‘register’ keyword in programming?

A

The ‘register’ keyword is used to declare variables that are stored in CPU registers for faster access.