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. Variable name should start with alphabet.

  2. Variable name contains the space.

  3. Variable name should be different from the keywords.

  4. Variable name contains underscore(_).

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

Space is not allowed in variable name. For example, RollNum is valid and Roll Num is invalid variable name.

Multiple choice
  1. value and types of variable

  2. name and location in the memory

  3. its value can change during execution.

  4. all of these

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

All of these are the characteristics of Variable. Variables must have its name, data type and value. Without data type variables cannot be declared. Variables also have some location in memory. And variables' value can be changed during the execution of a program.

Multiple choice
  1. switch(exp) { case value1: statement_1; case value2: statement_2; …………………… case valuen: statement_n; [default: statements ;] }

  2. switch(exp) { case value1: statement_1; case value2: statement_2; …………………… case valuen: statement_n; default: statements ; }

  3. switch(exp) { case value1: statement_1; case value2: statement_2; …………………… case valuen: statement_n; }

  4. switch(exp) { case value1; statement_1; case value2; statement_2; …………………… case valuen; statement_n; [default: statements ;] }

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

The correct syntax is as follows: switch(exp) { case value1: statement_1; case value2: statement_2; …………………… case valuen: statement_n; [default: statements ;] } The default statement is optional.

Multiple choice
  1. <font size="2">I</font>t allocates space for the literals.

  2. <font size="2">I</font>t compute<font size="2">s</font> the total length of the program.

  3. <font size="2">I</font>t builds the symbol table for the symbols and their value.

  4. <font size="2">A</font>ll of these

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

The first pass of a two-pass assembler performs three key tasks: allocating space for literals/pool table, computing the total program length (for address calculation), and building the symbol table with symbol addresses. All options are correct.

Multiple choice
  1. Global common subexpression

  2. Copy propagation

  3. Register allocation

  4. Code motion

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

a, b and d are ways of code optimization, register allocation happens in code generation stage, so the option c is the odd one.

Multiple choice
  1. No left recursive or ambiguous grammar can be LL(1)

  2. The class of grammars that can be parsed using LR methods is a proper subset of the class of grammars that can be the passed by LL method

  3. LR parsing is non - back tracking method

  4. LR methods can describe more languages than LL - grammars

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

Grammar passed by LR methods is a proper superset of the class of grammar parsed with LL method

Multiple choice
  1. i is true but ii is false.

  2. i and ii are true and ii is the cause of i.

  3. i and ii are true but ii is not the cause of i.

  4. Both of them are false.

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

Indirect triple consist of a listing of pointers to triples, rather than a listing of triples themselves.