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. 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
D Correct answer
Explanation

A variable is a named memory location used to store data that can be modified or updated during the program's execution. This distinguishes it from a constant.

Multiple choice
  1. To explain the code

  2. To ask the coder how he/she is doing

  3. To make the code work

  4. To avoid a syntax error

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

Comments are non-executable lines in code used by programmers to document and explain what the code does for human readers. They do not affect program execution.

Multiple choice
  1. Not consistent or having a fixed pattern; liable to change

  2. Somewhere to store functions

  3. Names used to store one or morevalues e.g. a users ages

  4. A symbol that represents a quantity

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

Variables are named containers for storing values that can be changed. Option C correctly describes variables as named storage for values like age.

Multiple choice
  1. Loops

  2. Selection

  3. Iteration

  4. Procudure

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

Selection statements (also known as conditional statements) allow a program to choose different paths of execution based on whether a condition is true or false.

Multiple choice
  1. if

  2. while

  3. when

  4. elif

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

The 'while' statement is a control structure used for iteration, meaning it repeats a block of code as long as a specified condition remains true.

Multiple choice
  1. int

  2. String

  3. Variable

  4. Function

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

A variable is a named storage location in memory that can hold a value, which can be changed or reassigned during program execution.

Multiple choice
  1. char arrays

  2. int arrays

  3. byte arrays

  4. Strings

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

The Java String class has constructors that accept char arrays, byte arrays, and String objects, but it does not have a constructor that accepts an int array.