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
  1. True

  2. False

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

OWB generates PL/SQL code for mappings and workflows, and this generated code can be modified by developers. While best practice is to let OWB regenerate code from the design, the system allows manual code customization for specialized requirements. The answer correctly states this is True.

Multiple choice technology programming languages
  1. The switch & case statement

  2. ?: (ternary operator)

  3. The #endif statement

  4. The nestedif statement

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

The switch and case statement provides a clean control structure to select and execute one of many blocks of code, acting as an alternative to long, chained if-else statements. Ternary operators and preprocessor directives do not serve this purpose.

Multiple choice technology programming languages
  1. No

  2. In certain conditions

  3. Yes

  4. None

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

When an exception is thrown, the first matching catch block handles it and no other catch blocks execute for that exception. Multiple catches are for different exception types, not multiple executions. Control transfers to finally or after the catch blocks.

Multiple choice technology programming languages
  1. True

  2. False

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

C++ fully supports functions as the fundamental building blocks for organizing code into reusable, modular units. Functions allow you to encapsulate specific tasks, pass parameters, and return values. This is a core feature of C++ inherited from C and essential for structured programming.

Multiple choice technology programming languages
  1. True

  2. False

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

C++ supports structures through the 'struct' keyword, which allows grouping related data items under a single name. Structures can contain different data types and are similar to classes, with the main difference being default access visibility (public for structs, private for classes). This feature is inherited from C and is fundamental to data organization.

Multiple choice technology testing
  1. to define object properties

  2. when parameterizing a step

  3. when creating checkpoints

  4. creating function calls

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

Regular expressions in QTP are primarily used for three purposes: defining object properties in descriptive programming, parameterizing steps with dynamic values in object repositories, and creating checkpoints that match patterns. They are NOT used for creating function calls - that's done through standard scripting methods. Option D correctly identifies what regular expressions are NOT used for.

Multiple choice technology testing
  1. assistive property

  2. Ordinal identifier

  3. both a & b

  4. None of the above

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

QTP uses mandatory properties (like class, name) as the primary object identification method. When these aren't sufficient to uniquely identify an object, QTP adds assistive properties to improve identification. If that still fails, it uses ordinal identifiers (index, location, creation time). Both assistive properties and ordinal identifiers are used when mandatory properties alone are inadequate.

Multiple choice technology testing
  1. a function has a single return value

  2. an action can have more than one output parameters

  3. Function and action are one and the same

  4. many functions can be used within an action

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

Functions and actions are distinct concepts in modular programming. A function is designed to return a single value and can be used inline within expressions, whereas an action can have multiple output parameters and handles side effects.

Multiple choice technology databases
  1. SET @TodaysDate = GETDATE()

  2. SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0)

  3. RETURN DATEADD(DD, 1, @TodaysDate)

  4. No error is generated. The function will be created.

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

In SQL Server, user-defined functions cannot call non-deterministic functions like GETDATE(). GETDATE() returns different values each time it's called, making it non-deterministic, which violates UDF restrictions. The rest of the function (stripping time, adding days) is syntactically correct, but the GETDATE() call makes it invalid.

Multiple choice technology programming languages
  1. const

  2. volatile

  3. mutable

  4. All the Above

  5. None of the Above

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

All three keywords qualify how variables are stored, qualified, or accessed in C++. The const keyword prevents modification, volatile prevents compiler optimizations for variables changed externally, and mutable allows members to be modified within const member functions.

Multiple choice technology programming languages
  1. call by value

  2. call by reference

  3. call by address

  4. All the Above

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

Passing pointers to functions allows the function to access and modify the original variables directly, mimicking call by reference behavior. While C++ introduces actual reference variables, passing pointers is traditionally called call by reference or call by address in C-like languages.

Multiple choice technology programming languages
  1. Inline functions

  2. virtual functions

  3. Both A and B

  4. None of the Above

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

Inline functions work by substituting the function body directly at the point of call, eliminating function call overhead. This is different from virtual functions, which use dynamic dispatch through vtables. The insertion of code at call point is the defining characteristic of inline functions.