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 technology programming languages
  1. two, two, one

  2. two, three, one

  3. two, two, three

  4. two, two, two

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

The first PUT resolves &one normally to 'two'. The double ampersand &&one resolves the first & as a delimiter, triggering another lookup of &one which gives 'two'. The triple &&&one resolves the first two as delimiters, looking up &&one (two), then &one (three). Output: two, two, three.

Multiple choice technology programming languages
  1. holds the input record for the next INPUT statement to read in the same iteration of the DATA step

  2. holds the input record for the next INPUT statement to read across further iterations of the DATA step

  3. holds the input record for the current input statement to read across further iterations of the DATA step

  4. All of the above

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

The single trailing @ holds the current input record in the input buffer for the next INPUT statement within the same DATA step iteration. It prevents SAS from moving to a new record until the iteration ends or a double trailing @@ releases it.

Multiple choice technology programming languages
  1. Weight statement

  2. Var statement

  3. Class statement

  4. By statement

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

In the PRINT procedure, the VAR statement specifies which variables to include in the output. WEIGHT is used in procedures like PROC MEANS or PROC REG for weighted analysis. CLASS is used for categorical variables in many procedures. BY is for grouping operations. VAR is the correct statement for variable selection in PRINT.

Multiple choice technology programming languages
  1. n = n->next; free( n );

  2. struct node m = n; n = n->next; free( m );

  3. free( n ); n = n->next;

  4. struct node m = n; free( m ); n = n->next;

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

To free a linked list, you must save the next pointer BEFORE freeing the current node, then advance. Option B: 'struct node m = n; n = n->next; free(m);' correctly copies the pointer, advances n to next, then frees the original node. Option A frees next instead of current (memory leak), Option C frees before reading next (use-after-free crash), Option D frees before advancing (memory leak).

Multiple choice technology programming languages
  1. True

  2. False

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

Iterators in Java are 'fail-fast' - they throw ConcurrentModificationException if the collection is modified during iteration (except through the iterator's own remove method). The iterator does not automatically update to reflect changes made directly to the collection during traversal.