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
INPUT is designed for interactive data entry where values change frequently. PRINT only outputs, LET assigns fixed values, and PROMPT is not a standard BASIC statement.
-
Error numeric value expected
-
Error character string expected
-
Redo from last entry
-
Redo from start
D
Correct answer
Explanation
When the user enters incorrect data type in BASIC INPUT (e.g., text when number expected), the message 'Redo from start' prompts re-entry from the beginning.
-
SELECT CASE
-
single-alternative block IF
-
double-alternative block IF
-
END
D
Correct answer
Explanation
SELECT CASE and both single-alternative and double-alternative block IF statements are all control structures that direct program flow. END is a termination keyword used to close blocks, but it doesn't control program flow itself. END simply marks the conclusion of a block structure like IF or SELECT CASE.
-
Inquiry-and-response
-
Print
-
Control
-
Flowcharting
C
Correct answer
Explanation
Control statements like IF, SELECT CASE, and loops allow programmers to alter the sequential execution of a program. Inquiry-and-response handles user input, Print displays output, and Flowcharting is a design tool. Only control statements actively change the flow of program execution by making decisions or repeating actions based on conditions.
-
END
-
END BLOCK
-
ELSEIF
-
END IF
D
Correct answer
Explanation
In block IF structures, the block must be properly terminated. The END IF statement marks the conclusion of the IF block. While END alone terminates other structures like SELECT CASE, the specific syntax for block IF requires END IF to properly close the conditional block and maintain code clarity.
-
An error message is displayed.
-
The program will execute the statement immediately before the block IF statement.
-
The block IF statement is executed again.
-
The first statement following the non-executable statement is executed.
D
Correct answer
Explanation
Non-executable statements like REM (remark/comment) are ignored during program execution. When a non-executable statement appears after a block IF, the program simply skips it and continues to the next executable statement. The block IF has already been evaluated, and execution proceeds to the first executable instruction following the REM statement. No error occurs, and the IF is not re-executed.
-
collating sequence
-
boolean operator
-
menu
-
relational operator
C
Correct answer
Explanation
A menu is a user interface element that displays a list of available program functions or options. Users select one item from the menu to invoke that specific function. Collating sequences determine character ordering, boolean operators combine logical conditions, and relational operators compare values - none of these display selectable function lists.
-
Both THEN and ELSE clauses may be executed
-
ELSE clause is always executed
-
Either THEN or ELSE clause will be executed
-
THEN clause is always executed
C
Correct answer
Explanation
In a double-alternative block IF, the condition is evaluated once. If true, the THEN clause executes and the ELSE clause is skipped. If false, the ELSE clause executes and the THEN clause is skipped. Only one of the two clauses ever executes during a single pass through the IF statement - never both, and never neither.
C
Correct answer
Explanation
The CLS (Clear Screen) command is used to clear the output screen in BASIC programming. This removes any previous text or output, providing a clean slate for displaying new program results. It's especially useful when you want fresh, uncluttered output for the user.
-
NumPeople
-
Num.People
-
Num_People
-
NUMPEOPLE
-
None; the statement is skipped.
-
The THEN part of the statement is executed.
-
The ELSE part of the statement is executed.
-
Both the THEN and the ELSE parts of the statement are executed.
B
Correct answer
Explanation
In an IF-THEN-ELSE structure, when the condition evaluates to true, only the THEN clause is executed. The ELSE clause is skipped entirely.
-
constant
-
character string
-
variable
-
number
C
Correct answer
Explanation
A variable is a named storage location that holds values which can be modified during program execution. Unlike constants, variables allow programs to work with changing data. This fundamental concept enables dynamic programming and data manipulation.
-
concurrency
-
conception
-
configure
-
concatenation
D
Correct answer
Explanation
Concatenation is the operation of joining two or more strings end-to-end to create a single combined string. This is a fundamental string operation in programming, used extensively in text processing, formatting output, and building file paths. The term comes from Latin meaning 'to link together'.
-
Syntactic error debugging in a program is the process of identifying and correcting errors.
-
Run-time or logical error debugging in a program is the process of identifying and correcting errors.
-
Debugging through the Internet is the process of downloading a large file.
-
Debugging is the process of defragmenting a hard disk.
-
None of these
-
INVALID_CURSOR
-
OPEN_CURSOR
-
CURSOR_ALREADY_OPEN
-
CURSOR_IS_OPEN
C
Correct answer
Explanation
The CURSOR_ALREADY_OPEN exception is thrown when we are trying to open a cursor that is already open. A cursor cannot be opened twice without closing it first.