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 technology programming languages
  1. Jerome

  2. Davin

  3. error

  4. firstname

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

The code creates an object using the Object constructor, assigns firstname='Jerome' and lastname='Davin', then alerts personObj.firstname which outputs 'Jerome'. The alert() function displays the value of the firstname property.

Multiple choice technology architecture
  1. purchase_date

  2. Credit_card

  3. null

  4. credit_card & product_id

  5. product_id

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

In the association table Purchaser_Product, a composite primary key consisting of credit_card and product_id is required to uniquely identify the relationship between a purchaser and a product, as neither column is marked as a unique primary key individually.

Multiple choice technology testing
  1. Option Declare

  2. Option Explicit

  3. Option Mandate

  4. None

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

Using Option Explicit at the start of a VBScript file forces the developer to declare all variables before using them, preventing typos and bugs. Statements like Option Declare and Option Mandate do not exist in VBScript syntax, making them incorrect distractors.

Multiple choice technology testing
  1. True

  2. False

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

VBScript supports only a single data type called Variant, which can contain different types of information depending on how it is used. Because of this, you cannot declare a variable of a specific type like Integer or String. This makes the statement true, rendering the false option incorrect.

Multiple choice technology testing
  1. 2

  2. 1

  3. 3

  4. No index is required for referencing an element in a 2D array. Index is applicable only for 1D arrays.

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

A 2-dimensional array requires exactly 2 indices to reference an element: one for the row and one for the column (e.g., array(1,2)). Option B is incorrect because one index only works for 1D arrays. Option C is incorrect as 2D arrays don't use 3 indices. Option D is incorrect because all arrays require indices for element access.

Multiple choice technology programming languages
  1. The step does not execute.

  2. The first numeric column is summed by default.

  3. The GROUP BY clause is changed to an ORDER BY clause.

  4. The step executes but does not group or sort data.

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

In PROC SQL, if you use GROUP BY without any summary (aggregate) functions like SUM, COUNT, AVG, etc., SAS automatically converts the GROUP BY clause to an ORDER BY clause. The step still executes but performs sorting instead of grouping. The other options are incorrect.

Multiple choice technology testing
  1. Unreachable Code

  2. Undeclared Variables

  3. Faults in requirements

  4. Too few comments

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

Static analysis tools examine source code without running it, allowing them to detect structural issues like unreachable code, undeclared variables, or insufficient comments. However, they cannot evaluate whether the program meets business needs, meaning faults in requirements can only be identified through dynamic testing or manual reviews.

Multiple choice technology packaged enterprise solutions
  1. Conversion

  2. Validation

  3. Authorisation

  4. Authentication

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

Edit Input rules are primarily used for CONVERSION of data from one format to another. They transform input values before they are stored or processed, such as converting text to uppercase, formatting dates, or transforming numeric values. Validation is handled by Validate rules, Authorization by Authorization rules, and Authentication by Authentication rules.

Multiple choice technology packaged enterprise solutions
  1. A rule used to validate that the data entered in a field is an integer.

  2. A rule used to ensure that all interested persons are apprised of a work object’s status

  3. A rule used to ensure that all required fields are complete.

  4. A rule used to validate that a user has the appropriate security to access a part of the application

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

A Validation rule in Pega is primarily used to ensure that all required fields are complete and that data meets specified criteria. It does not validate data types (that's done by edit validates), check security permissions, or notify interested parties (that's done by routing).

Multiple choice technology programming languages
  1. when arrays and references are passed

  2. only when references are passed

  3. args are not changed

  4. Command line args are changed

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

@, the default array for subroutine arguments, contains aliases to the actual passed elements. When arrays or references are passed, modifying @ changes the original data. For references, this affects the referenced object.

Multiple choice technology programming languages
  1. 1 and 2

  2. 5 and 0

  3. 1 and 3

  4. none of the above

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

In Perl list assignment, scalars consume single elements while arrays consume remaining elements. Here, \$t gets 'India', @u consumes all remaining elements ('US', 'Japan', 'Spain', 'Mexico', 'China' - 5 elements), leaving nothing for \$v and @w. Therefore @u has 5 elements and @w has 0.

Multiple choice technology programming languages
  1. 1 can only be called with predecleration of complex_num

  2. 1 and 2 are same

  3. 2 can only be called with predecleration of complex_num

  4. 1 is reference to a subroutine

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

In Perl, calling a subroutine without the ampersand sigil requires a pre-declaration (or prior definition) to let the compiler parse it properly, whereas using the ampersand allows calling it without such declarations. Therefore, the second syntax relies on pre-declaration, making this option correct.