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

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