Computer Knowledge

Programming Fundamentals

2,381 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. Their storage is temporary.

  2. They hardly handle large amount of data.

  3. They have storage permanent.

  4. Both (1) and (2)

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

Variables and arrays are stored in volatile memory (temporary) and are not suitable for handling large, persistent datasets.

Multiple choice
  1. The package definition must come first

  2. Class should be private

  3. Method should be without void

  4. None of these

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

Java source files follow a strict ordering rule where the package statement must be the first non-comment line. In the provided code, import statements appear before the package declaration, which will cause a compiler error. To fix this, the package student; line must be moved to the top of the file.

Multiple choice
  1. read from stream

  2. write to the stream

  3. both (1) and (2)

  4. none of these

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

Filter streams in Java are designed to wrap existing streams to provide additional functionality, such as buffering or data transformation. They can perform these filtering operations on data as it is being read from or written to the underlying stream.

Multiple choice
  1. mutable files

  2. Immutable files

  3. Transactions

  4. None of these

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

The all-or-nothing property, also known as atomicity, is a fundamental characteristic of transactions in database and distributed systems.

Multiple choice
  1. Immutable

  2. Mutable

  3. Both 1 and 2

  4. None of these

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

An immutable object or file is one whose state cannot be modified after it is created. This is a common concept in functional programming and distributed file systems.

Multiple choice
  1. arguments by reference

  2. arguments by value

  3. arguments by pointer

  4. arguments by variable

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

Java always passes arguments by value. For objects, the value passed is the reference to the object.

Multiple choice
  1. compile time

  2. run time

  3. execution time

  4. none of these

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

Static variables or global variables (often referred to as S in such contexts) are allocated memory at compile time.