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

  2. st

  3. struct

  4. stt

  5. structure

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

A struct in C programming language is a structured (record) type that aggregates a fixed set of labelled objects, possibly of different types, into a single object.

Multiple choice
  1. string.h

  2. stdio.h

  3. conio.h

  4. stdlib.h

  5. math.h

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

Input and Output operations can also be performed in C using the C Standard Input and Output Library (cstdio, known as stdio.h in the C language). This library uses what are called streams to operate with physical devices such as keyboards, printers, terminals or with any other type of files supported by the system.

Multiple choice
  1. malloc() is not used in C++.

  2. malloc() is type-safe but new is not type-safe.

  3. malloc() only allocates memory, while new operator allocates memory as well as constructs objects in C++.

  4. Both (2) and (3)

  5. None of these

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

Yes, this is the main advantage of using new operator over malloc() in C++.

Multiple choice
  1. It is used to create an alias for a known data type.

  2. typedef keyword can be used with unsigned char data type.

  3. typedef keyword cannot be used to define an alias for a function.

  4. Both (2) and (3)

  5. None of these

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

This is not true as we can also use typedef keyword to define an alias for a function in C++ and it can be used as function pointer.

Multiple choice
  1. Static variables

  2. Register variables

  3. Extern variables

  4. Auto variables

  5. None of these

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

Extern variables can be used to access in a file which is declared and defined in some other files, so these have a global scope outside the particular class and hence, they are called global variables.

Multiple choice
  1. This function instructs the compiler to insert copy of the code of that function at each point wherever that function is called at compile time.

  2. To make a function inline, we should place inline keyword before that function.

  3. Inline function reduces function calling overhead.

  4. Inline function decreases the function size.

  5. Inline function can make the header file size large.

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

No, inline function may increase the function size of your program, so this is the false statement about inline function in C++.

Multiple choice
  1. Inline function cannot be used with small functions.

  2. Inline function cannot be used in place of macros.

  3. Inline function is not applicable for the complicated function.

  4. Both (2) and (3)

  5. All of the above

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

This statement is true. In that case, the whole body of the function is placed when the function call is made every time in the program, so if the function is large it will affect the speed and memory of the program.

Multiple choice
  1. We cannot put a semicolon after the namespace definition.

  2. A namespace definition can be applied to multiple files.

  3. We can use namespace in the program by scope resolution operator.

  4. Only (1) and (2)

  5. All of the above

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

Yes, these all statements are true about namespace in C++.

Multiple choice
  1. 0

  2. NULL

  3. Depends on the scale and precision of the datatype.

  4. Without initialization, a variable cannot be used in the executable section of the block.

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

In PL/SQL, any variable that is declared but not initialized automatically has a NULL value, regardless of its datatype. This is a fundamental PL/SQL behavior - uninitialized variables are NULL, not 0 or any default value. Option A is incorrect because 0 is not assigned automatically. Option C is wrong because the initial value is always NULL regardless of scale/precision. Option D is false - uninitialized variables can be used, though they will have NULL values which may affect logic.