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
  1. True

  2. False

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

The print() function is a built-in command in Python used for outputting information, so the statement that it is NOT a command is false.

Multiple choice
  1. Let's the turtle out of its den.

  2. Makes everything work.

  3. Allows us to use turtle functions like fd() and pu().

  4. Imports the turtle from overseas.

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

The statement 'from turtle import *' imports all functions from the turtle module into the current namespace, allowing the programmer to use commands like fd() directly.

Multiple choice
  1. Function doesn't return a value, procedure returns a value

  2. Both return a value both are sub programs

  3. Procedure doesn't return a value, function returns a value

  4. Procedure allows the use of recursion

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

In procedural programming, a function is designed to return a value to the caller, while a procedure performs a task without returning a value.

Multiple choice
  1. Allows the code to be reusable

  2. There is less chance of errors

  3. Less copying and pasting of similar code

  4. A lot more programming code

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

Subprograms are used to reduce code complexity and improve maintainability; they do not increase the amount of code required, but rather help organize it.

Multiple choice
  1. Programming code following a logical order

  2. Programming code that repeats

  3. Programming code performs an action based on a condition

  4. Programming code that assigns a value to a variable

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

Sequencing is the basic construct where instructions are executed one after another in the order they appear.

Multiple choice
  1. Check a condition

  2. Assign a variable

  3. Repeat a statement based on a condition

  4. Assign a variable several times

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

Iteration, or looping, allows a block of code to be executed repeatedly as long as a specific condition is met.

Multiple choice
  1. Variable

  2. Constant

  3. Array

  4. Definition

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

An array is a data structure that can store multiple values under a single name. Variables and constants typically hold a single value at a time.

Multiple choice
  1. Constant

  2. String

  3. Character

  4. Boolean

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

A constant is a value that does not change during program execution, not a data type. String, Character, and Boolean are standard data types used to categorize data.

Multiple choice
  1. name == input

  2. name = input("Enter your name: ")

  3. name == input("Enter your name: ")

  4. name = int(input("Enter your name: "))

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

In Python, the input function is used to capture user input, and the assignment operator (=) stores that value into a variable. Option B correctly uses the function with a prompt string.

Multiple choice
  1. A memory location.

  2. A memory store that you cannot change.

  3. A value.

  4. A memory store that you can change.

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

A constant is a named memory location whose value is fixed and cannot be altered once the program is running. Variables, by contrast, are designed to have their values changed.