Languages [TCS Placement]: Sample Questions 121 - 123 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 121

Question MCQ▾

Cout is a/an ________.

Choices

Choice (4)

a.

Function

b.

Macro

c.

Object

d.

Operator

Edit

Answer

c.

Explanation

  • In most environments, standard output is on screen- C ++ stream object defined to access this standard output is cout. Cout is an object which encapsulates the complexity of outputting to the screen.
  • For formatted output operations, cout is used together with the insertion operator, which is written as << (i.e.. , two “less than” signs) .
Given the Image is Define the Output Using Cout Object

Question 122

Write in Short Short Answer▾

Is this program statement valid? INT = 10.50;

Edit

Explanation

  • Assuming that INT is a variable of type float, this statement is valid.
  • Reserved words are express in lowercase, so the C compiler will not interpret “INT” as a reserved word.
Given the Image is Defining the INT is a Variable of Type Float, this Statement is Valid

Question 123

Describe in Detail Essay▾

What is output redirection?

Edit

Explanation

  • It is the process of transferring data to an alternative output source other than the display screen.
  • Output redirection allows a program to have its output saved to a file.
  • For example, for program named COMPUTE, typing this on the command line “COMPUTE > DATA” will accept input from the user, perform certain computations, and have the output redirected to a file named DATA, instead of screen.
Given the Image is Defining the Redirecting Input from File