Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Numerical Constants (a) Integer Constants: These constants are represented with whole numbers. They require a minimum of 2 bytes and a maximum of 4 bytes

Numerical Constants
(a) Integer Constants: These constants are represented with whole numbers. They require a 
minimum of 2 bytes and a maximum of 4 bytes of memory.
The following concepts are essential to follow the numerical constants:
(a) Numerical constants are represented with numbers. At least one digit is needed for 
representing the number.
(b) The decimal point, fractional part, or symbols are not permitted. Neither blank spaces nor 
commas are permitted.
(c) Integer constant could be either positive or negative or may be zero.
(d) A number without a sign is assumed as positive.
Some valid examples: 10, 20, +30, -15, etc.
Some invalid integer constants: 2.3, .235, $76, 3 ^6, etc.
Besides representing the integers in decimal, they can also be represented in octal or hexadecimal number system based on the requirement.
Octal number system has base 8 and the hexadecimal number system has base 16. The octal 
numbers are 0, 1, 2, 3, 4, 5, 6, and 7 and the hexadecimal numbers are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
A, B, C, D, E, and F.
The representation of octal numbers in C would be done with leading digit 0 and for hex representation, with leading OX or OX.
Examples of octal and hexadecimal numbers:
Octal numbers - 027, 037, 072
Hexadecimal numbers - 0X9, 0Xab, 0X4
(b) Real Constants: Real constants are often known as floating point constants. Real constants 
can be represented in exponential or fractional form. Integer constants are unfit to represent 
many quantities. Many parameters or quantities are defined not only in integers but also in real 
numbers. For example, length, height, price, distance, etc. are also measured in real numbers.
The following concepts are essential to follow the real numbers:
(a) The decimal point is permitted.
(b) Neither blank spaces nor commas are permitted.
(c) Real numbers could be either positive or negative.
(d) The number without a sign is assumed as positive.
Examples of real numbers are 2.5, 5.521, 3.14, etc.
The real constants can be written in exponential notation, which contains fractional and exponential parts. For example, the value 2456.123 can be written as 2.4561 X e+
3.
The part that precedes e is called mantissa and the part that Age: 20
Height: 5.4
Sex: M
2.8 Variables
Variables are the basic objects manipulated in a program. Declaration gives an introduction of variable 
to compiler and its properties like scope, range of values and memory required for storage. A variable 
is used to store values. It has memory location and can store single value at a time.
When a program is executed, many operations are carried out on the data. The data types are 
integers, real or character constants. The data is stored in the memory, and at the time of execution it 
is fetched for carrying out different operations on it.
A variable is a data name used for storing a data value. Its value may be changed during the program execution. The variable value keeps on changing during the execution of the program. In other 
words, a variable can be assigned different values at different times during the program execution. 
A variable name may be declared based on the meaning of the operation. Variable names are made up 
of letters and digits. Some meaningful variable names are as follows.

image

Josefine is currently setting up a new computer network at The University of Algorithms. The network consists of N computers numbered from 0 to N - 1 that are initially not connected at all. She builds the network by adding network cables between pairs of computers one at a time. Two computers A and B are connected if there exists at least one series of cables that leads from computer A to computer B. As other students need to use connected computers while she is setting up the network, she needs to be able to answer if two specific computers are connected at a specific time. Given the sequence of "add cable" and "connected" operations, answer all the "connected" queries with a YES or NO. Example 1 2 3 4 5 LO 45 A01 01 C 0 3 A 1 3 C 0 3 Means the network consists of 4 computers. "A 0 1" means she adds a cable between computer 0 and 1. "C 0 3" asks if computer 0 and 3 are connected. The first time this question is asked, the answer is NO, but the second time they are connected by the cables between 0 and 1 and 1 and 3. Input format Line 1: The integer N and M (0 MN 1.000.000) where N is the number of computers and M is the total number of add/connected operations. Line 2..M+1: Either: "A c1 c2" meaning a cable is added between computers c1 and c2 (0 c1, c2 < N). "C c1 c2" asks if computers c1 and c2 are connected (0 c1, c2 < N). Output format Line i: YES or NO depending on the whether the computers in the ith connected operation were connected or not.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Thank you for providing information about numerical constants and variables in programmin... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bank Management and Financial Services

Authors: Peter Rose, Sylvia Hudgins

9th edition

78034671, 978-0078034671

More Books

Students also viewed these Computer Network questions

Question

How can loan servicing be used to increase income?

Answered: 1 week ago

Question

26. Name at least two ways a gene could influence alcoholism.

Answered: 1 week ago

Question

23. What are the effects of cannabinoids on neurons?

Answered: 1 week ago