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
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.
-
the control outside the loop stucture
-
the control outside the innermost loop
-
the control outside the program
-
none of these
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.
-
Rotate through Carrys
-
Carry instruction
-
Compare immediate
-
None of these
B
Correct answer
Explanation
Carry instruction allows direct control of the Carry flag by the programmer.
-
CALL instruction
-
RESTART instruction
-
RETURN instruction
-
JUMP instruction
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.
-
foreach loop
-
while loop
-
loop variant
-
recursion
-
loop invariant
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.
-
Variables
-
Functions
-
Interrupts
-
None of these
C
Correct answer
Explanation
Interrupts are the means of control to transfer a section of code irrespective of the code which is currently executing. Hence, the use of interrupts may cause faults in the program.
-
lower
-
title
-
upper
-
none of these
A
Correct answer
Explanation
In C language, program should be written in lower case. If we use upper case, then it will show error or it'll not be run.
-
True statement
-
False statement
-
Partially true
-
Invalid statement
A
Correct answer
Explanation
This statement is totally true. It is right that opening braces indicate begins and closing braces indicate ends of the function.
-
clrscr( )
-
go to( )
-
define & include
-
break ( )
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 (;).
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.
-
Input function
-
Output function
-
Scan the document
-
Print the program
A
Correct answer
Explanation
This is correct because in C language, Scanf function means input function.
-
Print the program
-
Input function
-
Output function
-
Scan the document
C
Correct answer
Explanation
This is correct option because in C language, Printf function means output function.
-
char ch [5]
-
char string_name [size]
-
char string_name [size]
-
data_type variable_name
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.
-
Top = - 1
-
Top = N - 1
-
Top = 0
-
Top = 1
-
Top = N
B
Correct answer
Explanation
This is the correct option as array subscript starts from 0, so it can have maximum of N - 1 subscript value from N number of elements.
-
Delimiter
-
Comment
-
Literal
-
String literal
B
Correct answer
Explanation
Adding comments to your program promote readability and aids understanding.