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 testing
  1. The use of a variable before it has been defined

  2. Unreachable (dead) code

  3. Memory leaks

  4. Array bound violations

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

Static analysis can detect coding issues like undefined variables, unreachable code, and array violations by examining source code structure. However, memory leaks are runtime behavioral issues that depend on execution patterns, resource allocation timing, and object lifecycle - these cannot be determined through static code examination alone. Memory leak detection requires runtime monitoring and profiling tools.

Multiple choice technology
  1. current time

  2. name of a process

  3. number of bytes per second

  4. percentage of processor time

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

In systems monitoring frameworks like IBM Tivoli, the 'Check for Missing Items' function is designed to alert when a specific named component, such as a process name, is not running or present. It is not applicable to numeric, rate, or time-based attributes.

Multiple choice technology
  1. True

  2. False

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

Mapplets can be nested within other mapplets in Informatica. This allows building reusable transformation components that themselves contain other mapplets, creating modular hierarchical designs.

Multiple choice technology programming languages
  1. Hello and world

  2. Foo and Bar

  3. i and j

  4. int and float

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

Foo and Bar are the classic metasyntactic variables used in programming examples and documentation, originating from MIT and hacker culture. While 'i' and 'j' are common loop counter variable names, they're not considered metasyntactic. 'Hello' and 'world' come from the famous beginner's program, but aren't placeholder variable names.

Multiple choice technology programming languages
  1. Modifying existing Data type.

  2. Used for defining type of data type used.

  3. Creating new data type names

  4. Not a valid key word

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

typedef creates an alias or new name for an existing data type, making code more readable and easier to maintain. For example, typedef unsigned int UINT; allows you to use UINT instead of unsigned int throughout your program. It does not modify the data type itself, just provides an alternative name for it.

Multiple choice technology programming languages
  1. True

  2. False

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

The typedef keyword itself is not machine dependent - it's a standard C language feature that works the same way across all platforms. However, the underlying types you create typedefs for (like int, long, pointer types) may have different sizes on different machines. The question asks about typedef itself, not the types it aliases.

Multiple choice technology programming languages
  1. (A), (B) & (C)

  2. (A), (C) & (E)

  3. (A), (C) & (D)

  4. (A) & (E)

  5. (C) & (E)

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

To answer this question, the user needs to have a basic understanding of flow control statements in programming. Flow control statements are used to control the order in which statements are executed in a program. They can be used to make decisions, loop over sets of instructions, and interrupt the normal flow of execution.

Now, let's go through each option and explain why it is right or wrong:

A. (A), (B) & (C): Option A is incorrect because (B) break(); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. Therefore, option A is incorrect.

B. (A), (C) & (E): Option B is correct. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. (E) return; is a legal statement that is used to exit a function and return a value. Therefore, option B is the correct answer.

C. (A), (C) & (D): Option C is incorrect because (D) continue(inner); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. Therefore, option C is incorrect.

D. (A) & (E): Option D is incorrect because (E) exit(); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (E) return; is also a legal statement that is used to exit a function and return a value. Therefore, option D is incorrect.

E. (C) & (E): Option E is incorrect because it is missing a legal statement. (C) continue outer; is a legal statement that is used to skip to the next iteration of an outer loop. (E) return; is also a legal statement that is used to exit a function and return a value. Therefore, option E is incorrect.

The Answer is: B. (A), (C) & (E)

Multiple choice technology programming languages
  1. True

  2. False

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

Python lists are mutable, meaning you can modify them after creation by appending, removing, or changing elements. This is different from tuples, which are immutable. You can change list elements using indexing (x[0] = 5), add elements with append() or extend(), or delete them with del or remove().

Multiple choice technology databases
  1. Declare, Open, Close

  2. Declare, Open, Fetch, Close

  3. Declare, Open, Fetch, Close, Remove

  4. None

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

An explicit cursor in PL/SQL has four lifecycle stages: DECLARE (defines the cursor in the declaration section), OPEN (executes the query and identifies the active set), FETCH (retrieves rows one at a time), and CLOSE (releases the active set and frees resources). Remove is not a standard cursor stage.

Multiple choice technology mainframe
  1. STOP

  2. END

  3. STOP RUN

  4. END RUN

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

STOP RUN is the statement used to terminate a COBOL program and return control to the operating system. It should be the last executed statement in the main program. STOP alone halts execution but is not the standard program termination, and END RUN is not a valid COBOL statement. END is used to mark the end of procedures or paragraphs, not terminate programs.

Multiple choice technology programming languages
  1. True

  2. False

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

Virtual destructors are essential in C++ polymorphism. When you delete a derived class object through a base class pointer, a virtual destructor ensures the correct destructor chain is called (derived first, then base). Without virtual destructors, only the base class destructor executes, causing resource leaks and undefined behavior.