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
-
Final
-
Static
-
Abstract
-
Immutable
A
Correct answer
Explanation
Final is a keyword which is used in three cases: (1) a final class means you cannot extend the class, i.e. you can't make a subclass, (2) a final method means you can not override the method, (3) a final variable means you cannot change it's value.
-
To make the code easier to read.
-
To indicate the start of a new line.
-
They are not used.
-
To maintain order of the lines at compile time.
C
Correct answer
Explanation
C source code is a plain text file. Line numbers are not part of the syntax and are not required by the compiler; they are only added by text editors for the convenience of the programmer.
-
Float
-
Double
-
Long
-
Character
D
Correct answer
Explanation
This answer is correct. MAX_RADIX is related to the character class since it gets the largest radix of the character sequence.
-
Both i and iii. are true
-
Both ii. and iv. are true
-
Both i. and ii. are true
-
Both iii. and iv. are true
C
Correct answer
Explanation
This answer is correct. Java only supports pass by value not pass by reference. The primitive data types are passed by value. Also, since no object defined for primitive types, primitive data types are passed only by value.
-
i. and ii both are correct.
-
i. and iv. both are correct.
-
ii. and iii. both are correct.
-
ii. only is correct
B
Correct answer
Explanation
This answer is correct. When the automatic type conversion has to happen between two variables, then both the data types should be compatible and also the destination type should be larger than the source type.
-
convert
-
cast
-
modify
-
alter type
-
All of the above
B
Correct answer
Explanation
This option is wrong because the cast datatype is used to convert a result value into another type.
-
For-Next
-
Goto
-
If-then-else
-
Repeat-unit
-
Break
B
Correct answer
Explanation
Structured programming emphasizes clear, logical flow using control structures like loops and conditionals. The 'Goto' statement is discouraged because it creates 'spaghetti code' that is difficult to read and maintain.
-
Declarative part is optional part.
-
Executable part is mandatory part.
-
Exception-handling part is mandatory.
-
The structure of a function is like that of a procedure.
-
The procedures are made for these subprograms.
-
frame check sequence
-
checksum
-
flow control
-
frame bursting
-
fourier analysis
A
Correct answer
Explanation
This is the correct option. Frame check sequence (FCS) refers to the extra bits and characters added to data packets for error detection and control. FCS technology is one of the best error control techniques and remains popular because of its simplicity.
-
inserting a '0' is user data stream to differentiate it with a flag
-
inserting a '0' in flag stream to avoid ambiguity
-
appending a nibble to the flag sequence
-
appending a nibble to the user data stream
A
Correct answer
Explanation
Bit stuffing (often called bit stuffing, not snuffing) is the process of inserting a bit (usually a 0) into a data stream to prevent a sequence of bits from being misinterpreted as a control flag.
-
unbinding
-
orthogonality
-
context-free
-
referential transparency
D
Correct answer
Explanation
Referential transparency is a property of expressions in programming where an expression can be replaced by its value without changing the program's behavior.
-
round-off errors.
-
syntax errors.
-
run-time errors.
-
logic errors.
A
Correct answer
Explanation
In numerical computing, performing many operations with floating-point numbers leads to the accumulation of small inaccuracies known as round-off errors. Syntax, run-time, and logic errors are distinct categories of programming mistakes.
-
procedural statements.
-
non procedural statements.
-
both (1) & (2)
-
loop statement.
C
Correct answer
Explanation
Application generators often allow users to define what the program should do (non-procedural) while also providing hooks or extensions for custom logic (procedural), thus combining both.
-
iteration
-
rendezvous statement
-
exception statement
-
all of the above
D
Correct answer
Explanation
Control structures define the flow of execution in a program. Iteration (loops), rendezvous statements (in concurrent programming), and exception handling are all mechanisms used to manage program flow.