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. gives an abend

  2. gives an error

  3. no error

  4. complier ignores

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

In SAS, omitting the RUN; statement does not generate an error or cause an abend. SAS will compile the step, but it may not execute immediately until another step boundary (such as a subsequent DATA or PROC step) or a RUN; statement is encountered.

Multiple choice technology programming languages
  1. int i[5][];

  2. int i[][];

  3. int []i[];

  4. int i[5][5];

  5. int[][] a;

Reveal answer Fill a bubble to check yourself
B,C,E Correct answer
Explanation

Java allows blank dimensions on the left side of array declarations. int[][] a, int []i[], and int i[][] are valid (declaring array type). However, int i[5][] or int i[5][5] are invalid because dimensions cannot be specified in declaration - only during initialization.

Multiple choice technology programming languages
  1. The beginning of the class definition.

  2. The end of the class definition.

  3. Anywhere in the class definition.

  4. None of the above

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

DECLARE_MESSAGE_MAP must be the last declaration in a class definition, appearing just before the closing brace. This macro declares the message map member variables and methods used by MFC's message routing system. Placing it anywhere else violates MFC conventions and will cause compilation errors.

Multiple choice technology databases
  1. True

  2. False

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

CAST is a SQL function that converts an expression from one datatype to another. For example, CAST('123' AS NUMBER) converts a string to a number. It's standard SQL syntax available in Oracle.

Multiple choice technology databases
  1. to_char

  2. to_number

  3. to_string

  4. to_date

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

TO_CHAR, TO_NUMBER, and TO_DATE are all valid Oracle conversion functions. TO_STRING is not a standard Oracle function - the correct function name for converting to string is TO_CHAR. This question tests knowledge of exact function names.

Multiple choice technology databases
  1. divert

  2. convert

  3. straight

  4. revert

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

CONVERT is a valid Oracle SQL function that converts character strings from one character set to another. The other options (divert, straight, revert) are not standard Oracle functions.

Multiple choice technology programming languages
  1. EVALUATE … END-EVALUATE

  2. SWITCH CASE

  3. CASE … END-CASE

  4. None of the above

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

The question asks about conditional execution based on a field value in Easytrieve. Option C 'CASE...END-CASE' is claimed correct and is indeed the Easytrieve construct for multi-way branching similar to switch/case in other languages. Option A 'EVALUATE' is not valid Easytrieve syntax. Option B 'SWITCH CASE' is not correct syntax. Option D is incorrect since CASE...END-CASE exists.

Multiple choice technology programming languages
  1. This statement cannot be coded in Easytrieve

  2. The input is could be inside the JOB activity

  3. There is no input to this job statement

  4. Both b & c

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

JOB INPUT NULL is a valid Easytrieve statement that specifies no input file for the JOB. Option C correctly states there is no input to this job statement. Option B, though poorly worded, correctly indicates that input can be specified inside the JOB activity itself. Therefore, both statements B and C are valid.

Multiple choice technology testing
  1. A. Built-in

  2. B. User-defined

  3. C. User-function

  4. D. Built-in, User-defined

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

UFT/QTP supports two types of environment variables: Built-in variables (predefined by the tool) and User-defined variables (created by testers). Built-in variables include system information like test path, OS type, and test name. User-defined variables can be added manually and accessed programmatically.

Multiple choice technology testing
  1. A. ++

  2. B. Next

  3. C. Skip

  4. D. Step

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

The Step keyword in VBScript For loops defines how the counter variable increments. Default increment is 1, but Step allows custom increments like Step 2 (count by 2) or Step -1 (count backwards). The Next keyword marks the end of the loop body, ++ is not valid VBScript, and Skip is not a loop keyword.

Multiple choice technology testing
  1. A. Dim statement

  2. B. Con statement

  3. C. Const statement

  4. D. Option Explicit statement

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

In VBScript, constants are declared using the Const statement (e.g., Const PI = 3.14). Dim is for variables, Con is not a valid statement, and Option Explicit forces variable declaration but doesn't define constants. Once assigned, constants cannot be modified during script execution.

Multiple choice technology programming languages
  1. Specifies that any variable name is declared (with type) before use

  2. Specifies whether String should be compared as binary

  3. Specifies that variables should be intialized before use

  4. All of the above

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

To understand the significance of the option explicit statement when it is set to ON, the user needs to know about the Option Explicit statement in Visual Basic for Applications (VBA) programming language.

The Option Explicit statement is used to explicitly declare all variables in a VBA code module. When Option Explicit is turned on, the user must declare all variables before they are used in the code. If a variable is not declared, VBA generates a compile-time error.

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

A. Specifies that any variable name is declared (with type) before use - This option is correct. When Option Explicit is turned on, it requires you to declare all variables before they are used in the code. This helps prevent errors and ensures that all variables have a defined type.

B. Specifies whether String should be compared as binary - This option is incorrect. The Option Compare statement is used to specify how VBA compares strings, not the Option Explicit statement.

C. Specifies that variables should be initialized before use - This option is incorrect. Option Explicit only requires variables to be declared before use, not initialized.

D. All of the above - This option is incorrect. Option Explicit only specifies that variables must be declared before use, not any of the other options listed.

Therefore, the correct answer is:

The Answer is: A