TCS Papers: Sample Questions 467 - 469 of 502

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

Question number: 467

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

Is this program statement valid? INT = 10.50;

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.

 Reserved words in image

Reserved Words in Image

Given the image is defining the INT is a variable of type float, this statement is valid.

Question number: 468

» Basic CS » Data Structures

Essay Question▾

Describe in Detail

What is Common Type System (CTS)?

Explanation

  • CTS is the CLR component which allows support for multiple languages through a type system common across all the languages.

  • Two CTS-compliant languages do not require type conversion when calling the code written in one language from within the code written in another language.

  • CTS provide a base set of data types for all the languages supported by. NET Framework.

  • That is size of integer and long variables is same across all. NET-compliant programming languages.

  • Each language internally uses aliases for the base data types provided by CTS.

  • For example, CTS uses the data type system. int32 to represent a 4 byte integer value- Visual Basic uses the alias integer for the same and C# uses the alias int.

The Common Type System (CTS)

The Common Type System (CTS)

Given the image is define the Common Type System (CTS)

Question number: 469

» Basic CS » Data Structures

Essay Question▾

Describe in Detail

In an AVL tree, at what condition the balancing is to be done?

Explanation

  • AVL tree is a self-balanced binary search tree. Named after their inventor Adelson, Velski, & Landis, AVL trees are height balancing binary search tree.

  • That means, an AVL tree is also a binary search tree but it is a balanced tree.

  • Balance factor of each node is passed on the path to an insertion to predict the nodes that go out of balance and determine the nodes closest to the insertion point. This node is called pivot node.

  • AVL tree checks the height of the left and the right sub-trees at the point of insertion and assures that the difference is not more than 1. This difference is called the “Balance Factor”.

  • If the difference in the height of left and right sub-trees is more than 1, the tree is balanced using rotation as

Image of the AVL tree

Image of the AVL Tree

Given the image is define the binary search tree and every node is satisfying balance factor condition. So this is said to be an AVL tree.

AVL tree rotations

AVL Tree Rotations

Given the image is define the AVL tree after rotations