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 technology programming languages
  1. try {throw 3;} catch(int i){ rethrow; }

  2. try {throw 3; rethrow ;} catch(int i){}

  3. try {throw 3;} catch(int i){ rethrow 3; }

  4. try {throw 3;} catch(int i){ throw; }

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

In C++, the correct syntax to re-throw the currently caught exception is a standalone throw; statement within a catch block. Specifying throw 3; or rethrow creates a new exception or results in syntax errors, as rethrow is not a keyword. Thus, the option using throw; is the syntactically correct choice.

Multiple choice technology programming languages
  1. logical_error

  2. runtime_error

  3. domain_error

  4. bad_exception

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

range_error inherits from runtime_error because it detects problems during execution when values fall outside valid ranges. This is distinct from logical_error, which is for violations detectable before the program runs (like invalid arguments).

Multiple choice technology programming languages
  1. Input Iterator

  2. Output Iterator

  3. Forward Iterator

  4. None of these

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

Forward iterators must support dereferencing (*), equality comparison (==), assignment (=), and increment (++). Input iterators lack assignment capability, and output iterators cannot compare equality, making Forward Iterator the correct answer.

Multiple choice technology mainframe
  1. True

  2. False

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

Variable scope is typically confined to its context. Different files can have variables with the same name because they operate in different scopes (file scope, local scope, namespaces). The names only conflict if they're in the same scope or improperly shared across compilation units.

Multiple choice technology mainframe
  1. READ and WRITE

  2. GET and PUT

  3. Both a and b

  4. None of the above

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

Random access I/O operations allow reading or writing specific records directly by key or position. READ and WRITE statements provide this random access capability. GET and PUT are typically used for sequential I/O processing where records are accessed in order.

Multiple choice technology
  1. (a) They are stored on the clipboard as temporary variables

  2. (b) They exist only within the context of an activity

  3. (c) They can be stored in the database

  4. (d) They are stored in a named page that is created automatically

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

Local variables in Pega activities are scoped only to that activity's execution context. They are NOT stored on the clipboard page (A), cannot be stored in the database (C), and are NOT in automatically created named pages (D). They exist temporarily during activity execution only.

Multiple choice technology programming languages
  1. catch (float)

  2. catch (...)

  3. catch (int)

  4. catch (long)

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

Exception handlers are evaluated sequentially, and the first handler that matches the thrown exception type catches it. Since an int is thrown and catch(int) appears before catch(...), the int handler is selected. The catch(...) is a catch-all for any unmatched exception type.

Multiple choice technology programming languages
  1. first >> second >>

  2. first >>

  3. Compile time Error

  4. Runtime Error -- ConcurrentModificationException

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

The code outputs 'first >>' because the while loop uses iterator.hasNext() which becomes false after the first iteration (iterator.next() advances past the only element 'first'), causing the loop to terminate before 'second' can be printed. There is no compilation error and ConcurrentModificationException only occurs with structural modifications during iteration.

Multiple choice technology operating systems
  1. Internal Field Seperator

  2. Internal File Seperator

  3. Implicit Field Seperator

  4. Implicit File Seperator

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

IFS (Internal Field Separator) is a shell variable that determines how word splitting occurs after expansion. It specifies the characters used to delimit fields in commands - typically space, tab, and newline.

Multiple choice technology programming languages
  1. True

  2. False

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

To solve this question, the user needs to know the basic syntax and rules of defining a function in computer programming.

In Python, a catch (or a function) can have comma-separated multiple arguments. These arguments can be used to pass values or variables to the function to perform some operation.

Therefore, the correct answer is:

The Answer is: A) True