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

  2. *

  3. ->

  4. <-

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

The arrow operator (->) is used to access members of a structure through a pointer. It combines pointer dereference and member access into a single operation. For a pointer p to a struct, p->member is equivalent to (*p).member.

Multiple choice
  1. the control outside the loop stucture

  2. the control outside the innermost loop

  3. the control outside the program

  4. none of these

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

The break statement only exits the innermost loop or switch statement enclosing it. In nested loops, a break in the inner loop transfers control to the first statement after that inner loop, allowing the outer loop to continue execution.

Multiple choice
  1. CALL instruction

  2. RESTART instruction

  3. RETURN instruction

  4. JUMP instruction

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

RETURN instruction provides a means, at the end of a subroutine, of resuming program execution at the instruction following the call instruction which invoked  the subroutine.

Multiple choice
  1. foreach loop

  2. while loop

  3. loop variant

  4. recursion

  5. loop invariant

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

In computer science, a loop is a programming language statement that allows code to be repeatedly executed; an invariant of a loop is a property that holds before (and after) each repetition. It is a logical assertion, sometimes programmed as an assertion. Knowing its invariant(s) is essential for understanding the effect of a loop.

Multiple choice
  1. clrscr( )

  2. go to( )

  3. define & include

  4. break ( )

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

The compile directives such as define & include are special instructions to the compiler to compile the program. They do not end with (;). 

Multiple choice
  1. #

  2. /* & *

  3. ( )

  4. < >

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

 This symbol is used when any comment insert in the program. The comment is written anywhere in the program. There is a no effect of comment in the output of the program. If we will insert comment without these symbols, then it will effect the program's output.

 

Multiple choice
  1. char ch [5]

  2. char string_name [size]

  3. char string_name [size]

  4. data_type variable_name

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

In this 'size' means how many characters can be hold in string. For example to define a string name of 10 character we can write char name[10]; hence, this option is correct.