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
  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. A new color will be created.

  2. There will be a runtime exception.

  3. Parameters are not enough.

  4. There will be an error Compile time error : cannot find method color.

  5. Compile time error : Color is abstract, cannot create an object.

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

This is the correct answer because color constructor creates a new colour but it takes parameters in the range 0-255. But here the value passed is 284(in first parameter).So a runtime exception named “IllegalArgumentException” will be thrown by the JVM.So this is the correct answer.

Multiple choice
  1. 4

  2. 3

  3. 2

  4. 1

  5. None of these

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

This is correct choice because the constructor of the Font class takes Three parameters :-First :- first parameter is of String type which specifies the name of the Font.Second :- second parameter is of type int which specifies the style of the font like Font.BOLD.Third :- third parameter is of type int which specifies the size of the font.ExampleFont f1 = new Font(“Serif”, Font.BOLD, 32);So this option is true.

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.

Multiple choice
  1. Frame consisting of the Employee_id, Employee_Name ,Employee_Address Items.

  2. Canvas

  3. Frame consisting of the DEPARTMENT_ID, MANAGER_ID, and LOCATION_ID items.

  4. The Departments block. The DEPARTMENT_ID, MANAGER_ID, and LOCATION_ID items All of the above

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

The Layout Wizard in Re-Entrant mode modifies properties of items within a selected frame. To alter the Department ID, Manager ID, and Location ID fields, you must first select the frame containing those specific items (DEPARTMENT_ID, MANAGER_ID, LOCATION_ID). The wizard cannot modify items directly without their parent frame being selected.