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

  2. False

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

The finally block will not execute because the try block contains either an infinite while(true) loop (never exits) or System.exit(1), which terminates the JVM immediately. In Java, System.exit() bypasses all exception handling and finally blocks.

Multiple choice technology programming languages
  1. ?:(Ternary Operator)

  2. .(member access)

  3. () (Paranthesis)

  4. ::(scope resolution)

Reveal answer Fill a bubble to check yourself
A,B,D Correct answer
Explanation

In C++, the ternary operator (?:), member access operator (.), and scope resolution operator (::) cannot be overloaded. These operators have fundamental meanings that must remain consistent. Function call operator () can be overloaded, which is why option C is incorrect.

Multiple choice technology
  1. gettype()

  2. is_double()

  3. get_type()

  4. is_date()

  5. A&B

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

PHP provides gettype() to determine a variable's type and is_double() as an alias for is_float() to specifically check for double/float types. Both functions serve type detection purposes, though is_double() is a deprecated alias for is_float(). The get_type() option is incorrect due to underscore placement, and is_date() is not a standard PHP function.

Multiple choice technology operating systems
  1. $# will print the same
  2. $? will print the same
  3. $! will print the same
  4. $$ will print the same
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In shell scripting, $# expands to the number of positional parameters passed to the script. Meanwhile, $? holds the exit status of the last executed command, $! contains the process ID of the most recent background command, and $$ represents the current shell's process ID.

Multiple choice technology
  1. True

  2. False

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

When searching for objects in MicroStrategy, you can select multiple object types simultaneously in the search dialog. The interface allows you to check multiple object type checkboxes (Reports, Documents, Metrics, Filters, etc.) to search across all selected types in a single operation, rather than being limited to one type at a time.

Multiple choice technology programming languages
  1. True

  2. False

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

Java does not have a preprocessor like C/C++. Java was designed without preprocessing features such as #define, #include, or conditional compilation to maintain platform independence and simplify the language. Compilation and preprocessing are handled differently in Java.

Multiple choice technology programming languages
  1. True

  2. False

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

In standard C++ (before std::string), there is no built-in string type - strings are implemented as char arrays or pointers. The std::string class is a library implementation, not a primitive language type. Modern C++ has string in the standard library, but it's still not a fundamental type like int or char.

Multiple choice technology programming languages
  1. int i = 0XCAFE;

  2. boolean b = 0;

  3. char c = A;

  4. byte b = 128;

  5. char c = "A";

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

Option A is valid: '0XCAFE' is a hexadecimal literal (hex digits start with 0X or 0x). Option B is invalid: boolean can only be 'true' or 'false', not 0. Option C is invalid: 'A' must be quoted as a character literal. Option D is invalid: byte range is -128 to 127, 128 overflows. Option E is invalid: char can't take a String literal.

Multiple choice technology
  1. datetime

  2. decimal

  3. void

  4. number

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

Ab Initio's valid datatypes include datetime, decimal, and various numeric types, but does not have a generic "number" datatype. The correct numeric types are specific types like int, decimal, float, etc. "void" is typically used in programming languages but not as a datatype in Ab Initio's DML.

Multiple choice technology
  1. A conditional field must not contain a reference to either a lookup function or a global variable.

  2. Although DML syntax allows you to include a function field as part of a conditional field, the function field is not conditional and works the same way whether or not the condition is met.

  3. A record type cannot declare nullable and conditional fields at the same time.

  4. A conditional field can share a delimiter with the record.

  5. For a conditional field to be nullable, it must have a default value.

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

This question asks which statement about conditional DML is FALSE. The correct answer is D because conditional fields CANNOT share delimiters with the record - each conditional field must have its own delimiter specification. Options A, B, C, and E are all true statements about conditional DML fields in Ab Initio.

Multiple choice technology
  1. String

  2. Char

  3. Decimal

  4. Integer

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

In Ab Initio DML, valid types include string, decimal, integer, date, datetime, and others. 'char' is NOT a valid DML type in Ab Initio - the correct type for character data is 'string' (or 'vector(string)' for arrays). Char might be confused with SQL character types, but Ab Initio DML uses 'string' instead.

Multiple choice technology programming languages
  1. a. The switch and case statement

  2. b. ternary operator

  3. c. nested if statement

  4. d. The #endif statement

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

The switch-case statement replaces multiple if-else statements when comparing a single expression against many constant values. This improves readability and can be more efficient. Ternary operators only replace simple if-else, and nested ifs are the opposite of simplification.