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 general knowledge science & technology
  1. True

  2. False

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

Multiple compilation errors: is_exist uses undefined variable 'n' (should be temp), uses undefined type 'boolean', and the result variable 'result' is never returned. The function tries to malloc a struct node instead of struct vg.

Multiple choice general knowledge
  1. True

  2. False

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

In object-oriented programming (like Java or C++), a constructor is a special method used to initialize objects. It does not have a return type, not even 'void', and therefore never returns a value.

Multiple choice general knowledge
  1. Shift+Alt+s, then t

  2. Shift+Alt+s, then g

  3. Shift + Alt + s, then r

  4. Shift+Alt+s, then c

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

Alt+Shift+S followed by R opens the Generate Getters and Setters dialog in Eclipse. The 'S' stands for Source menu, and 'R' triggers the getter/setter generation option from that menu.

Multiple choice general knowledge math & puzzles
  1. change

  2. bad

  3. break

  4. perform

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

The root "mut-" comes from Latin "mutare" meaning "to change." Common examples include "mutation" (change in DNA), "commute" (change travel route), and "immutable" (cannot be changed). "Perform" relates to "form-" meaning shape or perform.

Multiple choice general knowledge
  1. parseInt()

  2. exec()

  3. eval()

  4. parseFloat()

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

exec() is a method of RegExp objects, not a global built-in function. parseInt(), eval(), and parseFloat() are all global functions available without any object prefix. The exec() method must be called on a RegExp instance and returns match information for a regular expression test.

Multiple choice general knowledge
  1. new

  2. this

  3. delete

  4. typeof

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

'this' is a keyword that refers to the current execution context, not an operator. The new operator creates object instances, delete removes properties, and typeof returns a string indicating the operand's type. These are all JavaScript operators, but 'this' is a contextual keyword.

Multiple choice general knowledge
  1. Function declared static in the file1.c can access the variable

  2. All the functions in the file1.c can access the variable

  3. None of the options

  4. No function in file1.c can have access

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

A static variable at file scope (outside any function) has internal linkage - it's visible to all functions in the same file but not to other files. Option B correctly states that all functions in file1.c can access it. Option A is incorrect because there's no requirement for functions to be declared static.

Multiple choice general knowledge science & technology
  1. Checked

  2. Sealed

  3. ReadOnly

  4. Fixed

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

The 'fixed' statement in C# pins a managed variable in memory so the garbage collector cannot relocate it during pointer operations. This is essential when working with unsafe code and pointers, as moving the object would invalidate the pointer address. Checked is for overflow arithmetic, Sealed prevents inheritance, and ReadOnly allows only initialization.

Multiple choice general knowledge
  1. Debugging

  2. Compiling

  3. Interpreting

  4. None of these

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

Debugging is the process of identifying, isolating, and fixing errors or bugs in computer programs. Compiling translates code, interpreting executes code line-by-line, but only debugging specifically deals with error correction.

Multiple choice general knowledge
  1. Syntax error

  2. Symantic error

  3. Logical error

  4. Internal error

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

Compilers check source code against the language's grammar rules and report violations as syntax errors. These include missing semicolons, unmatched brackets, or incorrect keyword usage. Semantic errors relate to meaning (e.g., type mismatches) and may only be caught by some compilers, while logical errors (bugs) and internal errors are runtime or system issues beyond compilation.