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
-
jump the control to specific location o screen
-
hold the control for user input
-
end the program execution
-
restart the execution from beginning
-
jump the control up or down at its label
E
Correct answer
Explanation
The goto statement is used to jump the control in a program to its label in the function irrespective of its place in the sequence of coding.
-
It is a group of variables of similar datatype.
-
It stores the data in consucative memory location.
-
It is referred by a common name.
-
int val[5].
-
Array size can be changed during program execution.
E
Correct answer
Explanation
Increasing or decreasing of array size is not possible during program execution. Array size must be decided during program coding.
-
swap(i,j);
-
i=j; j=i;
-
i = i + j ;j = i - j ;i = i - j ;
-
j = i - j;i = i + j ;i = i + j ;
-
int temp;temp=i;i = j;j = temp;
C
Correct answer
Explanation
These are correct steps used to interchange the values from one variable to other without using any other variable.
-
It is a set of instructions.
-
It performs a specific task.
-
It is reusable.
-
It is modular programming.
-
None of these
E
Correct answer
Explanation
All above are actual properties of a function.
-
define P printf
-
define P printf
-
use P printf
-
<define p="printf="></define>
-
include
A
Correct answer
Explanation
This is used to define a different name of functions and this is the correct coding.
-
It is a function which calls to itself.
-
It is a process in which a function calls to itself.
-
It runs for definite number of time without condition.
-
It is used to call global function.
-
It is used to call local function.
B
Correct answer
Explanation
This is the correct option as recursion is a process in which a function calls to itself. It is commonly used to calculate factorials.
-
b and c
-
a, b and e
-
d and e
-
a, b, d and e
-
all of these
B
Correct answer
Explanation
The working of putch(), putchar() and fputchar() is same, they can print/output one character at a time.
e.g.
putch(‘A’);
putchar(‘B’);
fputchar(‘C’)
Output: ABC
-
Compares two strings regardless of case
-
Compares the portion of one string with portion of another string
-
Compares the portion of one string with portion of another string regardless of case
-
All of the above
-
None of the above
A
Correct answer
Explanation
strcmpi():Compares two strings without regard to case.
-
b and d
-
a, b and d
-
only c
-
all of these
-
none of these
C
Correct answer
Explanation
‘;’ is given after while in do-while loop whereas ‘;’ is not given after while in while loop
-
Working of while and do-while loop is same.
-
while(1) is infinite loop and exit() can be written to come outside the loop.
-
for(;;) implements an infinite loop.
-
A break statement takes the execution control out of the loop.
-
A continue statement skips the execution of the statements after the control to the beginning of the loop.
A
Correct answer
Explanation
Working of while and do-while loop is not same. As while is entry control and do-while is exit control.
-
struct test
{ int k; char ch; };
struct test t1,t2;
-
struct test
{ int k; char ch; }t1,t2;
-
struct
{ int k; char ch; }t1,t2;
-
struct test
{ int k; char ch; };
test t1,t2;
-
struct test
{ int k; char ch; };
struct test t[4];
D
Correct answer
Explanation
struct test
{ int k; char ch; };
test t1,t2;
the above declaration is wrong and it will show an error. As keyword struct is not written before test while creating variables of type test.
-
it cannot take a string
-
it cannot take a space character
-
it is used only for numerical values
-
it takes only float datatype
-
it take only int datatype
B
Correct answer
Explanation
Scanf terminates at space character so it is not used for string/Array. get(a) is the right choice for the purpose.
-
getchar( ), putchar( )
-
getch( ), printf( )
-
getche( ), scanf( )
-
printf( ), scanf( )
-
None of these
A
Correct answer
Explanation
These are two specific functions used for single character input and output of data.
-
a
-
If-Then-Else
-
While loop
-
GoTo
-
Decode
B
Correct answer
Explanation
If-Then-Else is a conditional control structure in PL/SQL that allows unconditional approach to different parts of code based on condition evaluation. The IF statement evaluates a condition and executes different code blocks accordingly, providing structured decision-making capability.
-
Declaration
-
Execution
-
Exception
-
Header
C
Correct answer
Explanation
In PL/SQL block structure, user-defined exceptions are trapped and handled in the EXCEPTION section. The DECLARE section is for declarations, the EXECUTE section (between BEGIN and END) contains executable logic, and there is no 'Header' section in standard PL/SQL.