Languages [TCS Placement]: Sample Questions 84 - 86 of 131

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 84

Edit

Describe in Detail

Essay▾

What is spaghetti programming?

Explanation

  • Spaghetti programming refers to codes that tend to get tangled and overlapped throughout the program.
  • One of the primary reasons for spaghetti code is “goto” stantement.
  • Another reason might me lack of experience on the part of the programmer.
  • Spaghetti programming makes a program complex and analysis difficult, and must be avoided as much as possible.
Given the Image is Define the Spaghetti Programming

Question 85

Edit

Write in Short

Short Answer▾

What is wrong in the statement? scanf ( “% d” , whatnumber) ;

Explanation

  • An ampersand “&” symbol must be placed before the variable name whatnumber.
  • Placing & means whatever integer value is entered by the user is stored at the “address” of the variable name.
  • This is a common mistake for programmers, often leading to logical errors.
Given the Image Define the Scanf () Function

Question 86

Edit

Describe in Detail

Essay▾

When is the “void” keyword used in a function?

Explanation

  • Function declarations could return a value or not.
  • If a function does not return a value then “void” is placed at the leftmost part of the function header.
  • When a return value is expected after the function execution, the data type of the return value is placed instead of “void” .
  • “void” keyword in return specifies that the function does not return a value.
  • In function parameter list “void” specifies that function takes no parameters.
  • In the declaration of a pointer void specifies that the pointer is “universal” .

Developed by: