Computer Knowledge

Programming Fundamentals

2,611 Questions

Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.

Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references

Programming Fundamentals Questions

Multiple choice

What is the weakest precondition operator wp in Dynamic Logic?

  1. It denotes the weakest condition that must hold before executing a program to ensure a desired postcondition.

  2. It denotes the strongest condition that must hold before executing a program to ensure a desired postcondition.

  3. It denotes the weakest condition that must hold after executing a program to ensure a desired postcondition.

  4. It denotes the strongest condition that must hold after executing a program to ensure a desired postcondition.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The weakest precondition operator wp in Dynamic Logic denotes the weakest condition that must hold before executing a program to ensure that a desired postcondition will hold after the program execution.

Multiple choice

What is the strongest postcondition operator sp in Dynamic Logic?

  1. It denotes the weakest condition that must hold before executing a program to ensure a desired postcondition.

  2. It denotes the strongest condition that must hold before executing a program to ensure a desired postcondition.

  3. It denotes the weakest condition that must hold after executing a program to ensure a desired postcondition.

  4. It denotes the strongest condition that must hold after executing a program to ensure a desired postcondition.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The strongest postcondition operator sp in Dynamic Logic denotes the strongest condition that must hold after executing a program to ensure that a desired postcondition will hold.

Multiple choice

What is the term used to describe the process of executing a program line by line?

  1. Compilation

  2. Interpretation

  3. Execution

  4. Linking

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Interpretation is the process of executing a program line by line, without the need for prior compilation.

Multiple choice

What is a cud error?

  1. When a piece of metal is stuck to a die

  2. When a die is broken

  3. When a die is worn

  4. When a die is misaligned

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Cud errors occur when a piece of metal, such as a piece of solder or a piece of another coin, is stuck to a die. This can cause errors on coins, such as raised areas or extra details.

Multiple choice

What is a mule error?

  1. When a coin is struck by a die that is intended for another coin

  2. When a coin is struck by a die that is broken

  3. When a coin is struck by a die that is worn

  4. When a coin is struck by a die that is misaligned

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Mule errors occur when a coin is struck by a die that is intended for another coin. This can result in a coin with the design of one coin on one side and the design of another coin on the other side.

Multiple choice

What is a transitional error?

  1. When a coin is struck by a die that is changing from one design to another

  2. When a coin is struck by a die that is broken

  3. When a coin is struck by a die that is worn

  4. When a coin is struck by a die that is misaligned

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Transitional errors occur when a coin is struck by a die that is changing from one design to another. This can result in a coin with elements of both designs.

Multiple choice

Which of the following is a common type of input validation error that can lead to vulnerabilities in mathematical software?

  1. Improper handling of negative inputs

  2. Lack of input sanitization

  3. Insufficient input validation

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

All of the above are common types of input validation errors that can lead to vulnerabilities in mathematical software.

Multiple choice

Which of the following is a common type of vulnerability that can be found in mathematical software?

  1. Buffer overflow

  2. Integer overflow

  3. Format string vulnerability

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

All of the above are common types of vulnerabilities that can be found in mathematical software.

Multiple choice

In computer science, a set of instructions that is executed repeatedly until a certain condition is met is known as:

  1. Loop

  2. Branch

  3. Jump

  4. Call

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A loop is a control structure in programming languages that allows a block of code to be executed repeatedly until a specified condition is met. Loops are used to iterate over data structures, perform calculations, and control the flow of a program.

Multiple choice

Which of the following is a common data validation technique?

  1. Range checking

  2. Data type checking

  3. Consistency checking

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Range checking, data type checking, and consistency checking are all commonly used data validation techniques.

Multiple choice

What is the most common type of buffer overflow vulnerability?

  1. Stack overflow

  2. Heap overflow

  3. Format string overflow

  4. Integer overflow

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Stack overflow occurs when a program writes data beyond the end of a stack buffer, overwriting other data on the stack.

Multiple choice

Which of the following is not a common type of error?

  1. Syntax errors

  2. Runtime errors

  3. Logical errors

  4. User errors

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Logical errors are not a type of error in a computer program. They are errors in the logic of the program, which can cause the program to produce incorrect results.

Multiple choice

Which of the following is not a common error-handling technique?

  1. Try-catch blocks

  2. Throw statements

  3. Assert statements

  4. Ignore errors

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Ignoring errors is not a common error-handling technique. It is generally considered to be bad practice, as it can lead to unexpected results.

Multiple choice

Which of the following is not a common type of user error?

  1. Mistyping

  2. Misunderstanding the instructions

  3. Entering invalid data

  4. All of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Mistyping, misunderstanding the instructions, and entering invalid data are all common types of user errors.

Multiple choice

What is the best way to handle errors that occur in a process?

  1. Use a try-catch block

  2. Use a throw statement

  3. Use an assert statement

  4. All of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The best way to handle errors that occur in a process is to use a try-catch block.