TCS Papers: Sample Questions 339 - 341 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 339

» Basic CS » Data Structures

Essay Question▾

Describe in Detail

Convert the expression ( ( (A + B) *C) - ( (D-E) ^ (F + G) ) ) to equivalent prefix and postfix notations.

Explanation

  • Prefix: ( ( (A + B) *C) - ( (D-E) ^ (F + G) ) )

    • ( ( (+AB) *C) - ( (-DE) ^ (+FG) ) )

    • ( (*+ABC) - (^-DE + FG) )

    • -*+ABC^-DE + FG

  • Postfix: ( ( (A + B) *C) - ( (D-E) ^ (F + G) ) )

    • ( ( (AB+) *C) - ( (DE-) ^ (FG+) ) )

    • ( (AB + C*) - (DE-FG+^) )

    • AB + C*DE-FG+^-

Question number: 340

» Languages » C & C Plus Plus

MCQ▾

Question

Destructor has the same name as the constructor and it is preceded by ________

Choices

Choice (4) Response

a.

?

b.

$

c.

!

d.

~

Answer

d.

Explanation

  • ~ (tield) sign is used to declare destructor.

  • Destructor destroys the memory allocated by constructor.

  • Destructor cannot be inherited.

  • Destructor is called when an object is destroyed.

  • The destructor must have the same name as the class; precede by a tilde (~).

  • The destructor cannot take arguments and has no return type.

Image shows the Destructor

Image Shows the Destructor

Given the image is define the destructor in c++

Question number: 341

» Languages » C & C Plus Plus

True-False▾

Question

Is the Following Statement True or False?

Not all reserved words are written in lowercase.

Answer

FALSE

Explanation

  • FALSE.

  • All reserved words must be written in lowercase; otherwise the C compiler would interpret this as unidentified and invalid.

The reserved words in c

The Reserved Words in C

Given the image defining the reserved words are in lowercase.