+1 and +2 Computer Science

Previous Question paper answered , and Questions from Textbook

+1 and +2 Computer Application

Previous Question paper answered , and Questions from Textbook

Diploma in Computer Application (DCA)

Previous Question paper answered , and Questions from Textbook.

Master of Computer Applications (MCA)

Previous Question paper answered , and Questions from Textbook

True IQ Computer Online Academy

Contact : +91 9036433020 , mail2trueiq@gmail.com

Pageviews

Showing posts with label Data Types And Operators. Show all posts
Showing posts with label Data Types And Operators. Show all posts

Saturday, 2 November 2019

+1] 8 - Arrays - Previous Questions Chapter wise



                                 PLUS ONE COMPUTER SCIENCE

            First Year Computer Science Previous Questions Chapter wise ..
                                                      
                                                          Chapter 8. Arrays


1. An array is declared as follows: int a[5] = {1, 2, 3, 4, 5}; What will be the value of a[2] + a[3]?

 a) 7

 b) 5

c) 6

d) 4

 Ans. a

2. Write C++ statements to double each element of the array int A[100].

 3. Consider an array A with the following elements sorted in ascending order. 5, 9, 10, 13, 16, 17, 19, 20, 25, 37 Explain the working of binary search algorithm to search 25. How many comparisons are required for this searching?

 4. Find the value of score[4] based on the following declaration statement:

 int score[5] = {98, 87, 92, 79, 85};

     Ans. 85

5. Suppose M[5][5] is a 2D array that contains the elements of a square matrix. Write C++ statements to find the sum of the diagonal elements.

     #include <iostream>
using namespace std;
int main()
{ int mat[5][5], n, i, j, s=0;
cout<<"Enter the rows/columns of square matrix: ";
cin>>n;
cout<<"Enter the elements\n";
for(i=0; i<n; i++)
for(j=0; j<n; j++)
cin>>mat[i][j];
cout<<"Major diagonal elements are\n";
for(i=0; i<n; i++)
{
cout<<mat[i][i]<<"\t";
s = s + mat[i][i];
}
cout<<"\nSum of major diagonal elements is: ";
cout<<s;
return 0;
}

6. Write an algorithm for arranging elements of an array in ascending order using bubble sort.

       Step 1. Start

      Step 2. Accept a value in N as the number of elements of the array

      Step 3. Accept N elements into the array AR

     Step 4. Repeat Steps 5 to 7, (N - 1) times

      Step 5. Repeat Step 6 until the second last element of the list

        Step 6. Starting from the first position, compare two adjacent elements in the list. If they are not in proper order, swap the elements.

      Step 7. Revise the list by excluding the last element in the current list.

     Step 8. Print the sorted array AR

        Step 9. Stop

 7. ………………. search method is an example for ‘divide and conquer method’.

   Ans. Binary search

8. What is an array? Write C++ program to declare and use a single dimensional array for storing the computer science marks of all students in your class.

       An array is a collection of elements of the same type placed in contiguous memory locations. Arrays are used to store a set of values of the same type under a single variable name. Each element in an array can be accessed using its position in the list called index number or subscript.

9. a) Write C++ program for sorting a list of numbers using Bubble sort method.

    b) Write different passes of sorting the following numbers using Bubble sort:

         32, 21, 9, 17, 5

    Ans. a.

  #include <iostream>
using namespace std;
int main()
{
int AR[25],N;
int I, J, TEMP;
cout<<"How many elements? ";
cin>>N;
cout<<"Enter the array elements: ";
for(I=0; I<N; I++)
cin>>AR[I];
for(I=1; I<N; I++)
for(J=0; J<N–I; J++)
if(AR[J] > AR[J+1])
{
TEMP = AR[J];
AR[J] = AR[J+1];
AR[J+1] = TEMP;
}
cout<<"Sorted array is: ";
for(I=0; I<N; I++)
cout<<AR[I]<<"\t";
}

10. Declare a two dimensional array to store the elements of a matrix with order 3 x 5.

    Ans. int M[3][5];

11. Define an array. Also write an algorithm for searching an element in the array using any one method that you are familiar with.

        An array is a collection of elements of the same type placed in contiguous memory locations. Arrays are used to store a set of values of the same type under a single variable name. Each element in an array can be accessed using its position in the list called index number or subscript.

      Algorithm for Linear Search

 Step 1. Start

Step 2. Accept a value in N as the number of elements of the array

 Step 3. Accept N elements into the array AR

Step 4. Accept the value to be searched in the variable ITEM

 Step 5. Set LOC = -1

 Step 6. Starting from the first position, repeat Step 7 until the last element

Step 7. Check whether the value in ITEM is found in the current position. If found then store the position in LOC and Go to Step 8, else move to the next position.

 Step 8. If the value of LOC is less than 0 then display "Not Found", else display the value of LOC + 1 as the position of the search value.

 Step 9. Stop

12. int num[10];

The above C++ statement declares an array named num that can store maximum …. integer location.

 a) 9

b) 10

c) N

d) none of these

 Ans. b

 13. Explain the memory allocation for the following declaration statement. int A[10][10];

 14. Write a C++ program to illustrate array traversal.

         #include<iostream>

      using namespace std; 

      int main() 

      { 

          int a[10], i; 

      cout<<"Enter the elements of the array :";

      for(i=0; i<10; i++) 

       cin >> a[i];

      for(i=0; i<10; i++) 

     a[i] = a[i] + 1;

     cout<<"\nEntered elements of the array are...\n"; 

     for(i=0; i<10; i++) 

     cout<< a[i]<< "\t";

    return 0;

  }

15. Read the following C++ statement: int MAT[5][4];

(a) How many bytes will be allocated for this array?

(b) Suppose MAT[4][4] is a 2D array that contains the elements of a square matrix. Write C++ statements to find the sum of all the elements in the array.

    Ans. 
            a. 4*5*4=80 bytes

16. Write the names of two searching methods in arrays. Prepare a chart that shows the comparison of two searching methods.

        Linear search and Binary search.

         Linear search method                                                 Binary search method 

  • The elements need not be in any order                           • The elements should be in sorted order

 • Takes more time for the process                                     • Takes very less time for the process

 • May need to visit all the elements                                   • All the elements are never visited

 • Suitable when the array is small                                      • Suitable when the array is large


Friday, 6 September 2019

+1]5 . Data Types And Operators - Previous Questions from chapter wise



               PLUS ONE 
COMPUTER APPLICATION / COMPUTER SCIENCE

            First Year Computer Application(Commerce) Previous Questions Chapter wise ..


                                         Chapter  5 (6 for CS) Data Types And Operators




1. Given that x= 5  y=5. What will be the value of the expression x > y|| y > x? 

     Ans. False

2.  While writing a C++ program, a student forget to put semicolon at the end of a   declaration                  statement.What type of error can he expect during compilation ? 

     Ans. Syntax Error

3.   The memory size of float data type in C++ is ...............  bytes.


    a)2

     b)4 

     c)8 

      d)10 

   Ans. b

4.  Explain different types of  logical operators on C++

   and (&&):( Result will be true  only if both the combined expressions have true value)      

  or(||):Result will be true  only if any of  the combined expressions have true value )     

 not(!): To get the negation of the give expression

 d). input/out put operators: input(get from or extract operator), output (put to or  insertion operator) 

e). Assignment operator: = (to assign a value to a variable). 

5.  What is the difference between “=” and “= =” operators?

           When we have to store a value in a memory location, assignment operator (=) is used. This is a binary operator and hence two operands are required. The first operand should be a variable where the value of the second operand is to be stored.

         The = symbol assigns a value to a variable, whereas == symbol compares two values and gives True or False as the result.

6.   What is the difference between  x= 5  and x ==5 in C++

          x=5 means the value 5 is assigned or stored the variable X but X==5 means both values are compares and it gives true or false as the result. 

7. Identify the name of following operators in C++. 
      && , || , !

  Ans. && : Logical And

           ||  : Logical Or

            ! : Logical Not

8.  .Write the declaration in C++ for a variable that can be used to store height of  a   student.                    Justify, why you  have selected this data type in the declaration. 

  Ans. float Height ;

9.  Which of the following is not a character constant in C++? 
      a) ‘a’

      b) a

      c) ‘8’

       d)’\a’  

    Ans. b

10. . Memory requirement of void data type in C++ is .......... byte(s

     Ans. 0 byte

11. .Let X and Y are two variables of int data type, then correct the following  input                               statement.  

  cin<< X >> Y;

   Ans. cin>>X>>Y;

12. Write the output of the following C++ expressions. Let a=7,b=2.

     a) a+b *3/ ++b;    

     b) a<=7&&b>1;

   Ans. a) 7+2*3/++2 = 7+2*3/3 =7+2*1 =7+2=9

            b) 7<=7&&2>1 ----->True statement 

13.  Write value returned by the C++ expressions

      a). 60 % 25;

      b).  22 / 7; 


     Ans. a. 10

              b. 3


14.  How do the type modifiers affect the size and range of int and char data types?

          By using different number of bytes to store values, C++ offers three types of integers : short, int, and long that can represent up to three different integer sizes. Each comes in both signed and unsigned versions.In integer 4 bytes are used,ranges from 2147483648 to +2147483647.

     

The char type can also be signed or unsigned. Unlike int, char is neither signed nor unsigned by default. The choice is left to the C++ implementation in order to allow the implementer to best fit the type to the hardware properties.

However, these distinctions are particularly important if you are using char as a numeric type. The unsigned char represents the range 0 to 256 and signed char represents the range -128 to 127.In char 1 byte is used.

15 . Explain the difference between float g=9.8 ; and const float g=9.8?

             ref 6th chapter QS 12

16. What is implicit type conversion?Why it is called type promotion ?

             Implicit Type Conversion also known as 'automatic type conversion'. Done by the compiler on its own, without any external trigger from the user. Generally takes place when in an expression more than one data type is present. In such condition type conversion (type promotion) takes place to avoid lose of data.

17.  Distinguish between float and double data types in C++.

            Float : They are numbers with fractional part. It uses four bytes of memory. It  can be                                      represented either by scientific notation or mantissa exponential  method. 

          Double: It is used for handling large floating point numbers. It uses 8 bytes of memory.

18. . What is a variable ?Differentiate between memory address and content of the variable.

           Name given to a memory location is known as variable. It is use to store and retrieve data. It have three part: a) variable name  b). Memory address(starting address of the allocated memory)       c). Content .

       The RAM of a computer consists of collection of cells each of which can store one byte of data. Every cell (or byte) in RAM will be assigned a unique address to refer it. All the variables are connected to one or more memory locations in RAM. The base address of a variable is the starting address of the allocated memory space.

    The value stored in the location is called content of the variable. This is also called the R-value of the variable. Type and size of the content depends on the data type of the variable. Here the variable name is Num and it consumes 4 bytes of memory at memory addresses 1001, 1002, 1003 and 1004. The content of this variable is 18. That is L-value of Num is 1001 and R-value is 18.


           Image result for memory allocation of a variable images    
19.  Briefly explain any two expressions in C++. 

         expressions are composed of operators and operands. It is evaluated to get a         value(returning of value) On the basis of operators expressions can be divided into,

 a). Arithmetic expression: Expression in which arithmetic operators are used ( may be integer  or             floating point expression)

 b). Relational expression : Expression in which relational operators are used 

20.  Predict the output of the following operations. x = -5 and y = 3 initially.           

a). –x 

b). x/y  

c). x % y 

d). –x + -y 

Ans.a.  -(-5) = 5

         b.  -5/3 =-1

           c. -5%3 = -2

            d. -(-5)+-3 =2

21. . Consider the following statement.  int length;          
Then what is the difference between (a) and (b)?  a). length = 50; b). length = = 50; 

         refer Qs no.s 5 and 6

22.  Write sample statements in C++ for the cascading of input and output operators

            Multiple use of Input / Output operators in a single statement is called cascading of I/O Operator. Here the values are assigned to the variables from left to right.

 Eg. cout << x <<y <<z;

         cin >> x >> y;

23.  Explain the operations involved in the following C++ expressions and write the output.

 a) 5/2+3

 b) (10%3)/2.0

   Ans. a. 5

           b. 0.5

24. Write four different C++ statements to add 1 to the value stored in the variable     
   Num.

25.  What is the output of the following C++ statements.
   X= -7    Y = 3
   a) add –x with –y
   b) x  modulus  y

  Ans. a. -(-7)+3 =10

          b. -7%3 = -1

26. . What are data types ?Explain the fundamental data types in C++.

            Data types are the means to identify the nature of the data and the set of operations that can be performed on the data.

    There are three types of data types C++,

a). Fundamental data type (built in Data types):

 They are defined in the C++ compiler. They can not be further broken down. There are 5 types of Fundamental data types,

1). Char: They are symbols covered by the character set of C++ language. It uses only one byte                       of memory (storing in memory with its ASCII value). 

2). Int  : Whole numbers without fractional part. It can be positive or negative, or zero. It uses                       Four bytes of memory based on GCC compiler.

 3). Float : They are numbers with fractional part. It uses four bytes of memory. It  can be                            represented either by scientific notation or mantissa exponential  method.

 4). Double: It is used for handling large floating point numbers. It uses 8 bytes of memory.

 5). Void : uses zero bytes of memory.

27.  Classify the identifiers given below as valid and invalid .Give reason for invalidity.

sum

if

_Num 1

Switch

stud Age

   Ans. Valid: sum,_Num1

          Invalid : if ,Switch,stud Age

       if and Switch are keywords. stud Age is invalid identifier because white space is prohibited.

28.If a=5, b=7 and c=3.  Predict the output of the following expresssions.

a) a<c

b) b%a

 c) (a<c) && (a<b)

 d) a/c

  Ans. a. False

            b. 7%5 = 2

             c. False

              d. 5/3 =1

29.  Predict the value of 'b' in the following C++ code after execution of each code snippet

   a) and  b) Justify your answer.

 a) a = 5; b = a++;

 b) a = 5; b = ++a;

Ans. a. b=5

          b. b=6

30.   List the three numeric data types in C++ with an example for each

31.  If a = 5,   b = 4,   c = 3,  d = 4 then what is the result in x after following operation?

       X=a + b – c * d;

        Ans. X =5+4-3*4 = 5+4-12 = -3

32.  Is there any difference between (a) and (b) by considering the following statement?   char             Gender;        a). Gender  = ‘M’;        b). Gender = “M”;

          In Gender='M' means  Characters are the symbols covered by the character set of the C++ language. All letters, digits, special symbols, punctuations, etc. come under this category. When these characters are used as data they are considered as char type data in C++. We can say that the keyword char represents character literals of C++. Each char type data is allowed one byte of memory.

        Gender="M" is wrong statement because single character representation using single quote.

33.  Write a short note on arithmetic And logical operators in C++.

          Arithmetic operators are defined to perform basic arithmetic operations such as addition, subtraction, multiplication and division. The symbols used for this are +, -, * and / respectively. C++ also provides a special operator % (modulus operator) for getting remainder during division. All these operators are binary operators. Note that + and - are used as unary operators too. The operands required for these operations are numeric data. The result of these operations will also be numeric.

         Using relational operators, we can compare values. Examples are 3<5, num!=10, etc. These comparison operations are called relational expressions in C++. In some cases, two or more comparisons may need to be combined. In Mathematics we may use expressions like a>b>c. But in C++, it is not possible. We have to separate this into two, as a>b and b>c and these are to be combined using the logical operator &&, i.e. (a>b)&&(b>c). The result of such logical combinations will also be either True or False (i.e. 1 or 0). The logical operators are && (logical AND), || (logical OR) and ! (logical NOT).

34.  Write the equivalent arithmetic operations for the given C++ short hands.

 i) x% =20;    il) a+=2;   Iii)p / = 5;

 b) What is the difference between a = 20 and a = = 20?

     Ans. X=X%20
    
            b. a=a+2

             c. p=p/5


          a=20 means  the constant 20 is assigned to the variable a. a==20 means compares two values and it gives may true or false as the result.

35.  Classify the following identifiers valid or invalid. If invalid give reason.

 a). Length_1

 b). _Length1

c). Length 1

d). 1Length 

Ans. Valid: Length_1 ,_Length1

          Invalid : Length 1 ,1Length. Because identifiers are not using digit in first and Between words white spaces are not  alloweded.
       

Sunday, 1 September 2019

+1]5. Data Types And Operators - solved Questions from text book

PLUS ONE 
COMPUTER APPLICATION / COMPUTER SCIENCE                    
Chapter 5 (6 for CS) Data Types And Operators

(+1. Computer Application Questions and answers from text book)



1. Predict the output of the following operations if x=5 and y=3.

a. x>=10 && y>=4                       

 b. x>=1 && y>=3

c. x>5 && y>=2

 d. x<10 && y>2

e. x<10 && y>x

f. x>=10 || y>=4

g. x>=1 || y>=3

h. x>5 || y>=2

 i. x<10 || y>2

 j. x<10 || y>x

Ans.   a. FALSE                   

          b. TRUE

         c. FALSE

         d. TRUE

         e. FALSE

          f.  FALSE

           g. TRUE

           h.  TRUE

            i. TRUE

            j. TRUE

 2. Predict the output if p=5, q=3, r=2

 a. p-q*r/2                       

b. p*q/r                               

c. p-q-r*2+p

d. p+5*q+r*r/2

  Ans. a. 5-3*2/2 = 5-3*1 =2

            b. 5*3/2 =7.5
 
            c. 5-3-2*2+5 =5-3-4+5 =10-7=3

            d. 5+5*3+2*2/2 = 5+15+2 =22

3. What are data types? List all predefined data types in C++?

          Image result for different types of expressions in c++ images

            Data types are the means to identify the nature of the data and the set of operations that can be performed on the data.

            There are 5 types of Fundamental data types,
1). Char: They are symbols covered by the character set of C++ language. It uses only one byte                       of memory (storing in memory with its ASCII value).
 2). Int  : Whole numbers without fractional part. It can be positive or negative, or zero. It uses                       Four bytes of memory based on GCC compiler.
 3). Float : They are numbers with fractional part. It uses four bytes of memory. It  can be                            represented either by scientific notation or mantissa exponential  method.
  4). Double: It is used for handling large floating point numbers. It uses 8 bytes of memory. 
5). Void : uses zero bytes of memory.

4. What is the use of void data type?

        The data type void is a keyword and it indicates an empty set of data. Obviously it does not                   require any memory space.
5. What is a constant?

       Constants are like a variable, except that their value never changes during execution once defined. ...Constants in C are the fixed values that are used in a program, and its value remains the same during the entire execution of the program. Constants are also called literals. Constants can be any of the data types.

6. What is dynamic initialization of variables?

        Dynamic initialization is that in which initialization value isn't known at compile-time. It's computed at runtime to initialize the variable. Example, ... That is, static-initialization usually involves constant-expression (which is known at compile-time), while dynamic-initialization involves non-constant expression.

7. Define operators.

        Tokens constituted by predefined symbols that can trigger to carry out operation. The participants of the operation are called operands. The operators either be constant or literal

6. What is meant by a unary operation?

         only one operand( eg +(positive),-(negative)

example:+x,-y etc.

7. What is declaration statement?

           It is used to declare the type of the variable or constant used in  the program. 

           Eg. int   x, y ; int a=10;
8. What is the input operator ">>" and output operator "<<" called ?

           extract operator(>>) and  insertion operator(<<)

9. What will be the result of a = 5/3 if a is
(i) float

 (ii) int

    Ans. i. 1.66

             ii. 1
 
10. Write an expression that uses a relational operator to return true if the variable
total is greater than or equal to final.

11. Given that i =4, j =5, k =2 what will be the result of following expressions?

(i) j <k          ------------                 False

(ii) j <j         -----------                     False

 (iii) j <= k    -----------                    False

(iv) i == j         ------------                 False

(v) i == k          -----------                  False

(vi) j > k            ----------                   True

(vii) j >= i          ----------                 True

(viii) j! = i          ------------              True

 (ix) j! = k          ---------------           True

(x) j <= k           ---------------            True


12. What will be the order of evaluation for following expressions?

(i) i+5>=j-6

 (ii) s+10<p-2+2*q

   Ans. i.

13. What will be the result of the following if ans is 6 initially?

(i) cout <<ans = 8 ;

(ii) cout << ans == 8


Ans. i.

14. What is a variable? List the two values associated with a variable.

        Name given to a memory location is known as variable. It is use to store and retrieve data. It have three part: a) variable name  b). Memory address(starting address of the allocated memory)       c). Content 4

 15. Explain logical operators.

      and (&&):  ( Result will be true  only if both the combined expressions have true value).

     or(||):  Result will be true  only if any of  the combined expressions have true value ).   

      not(!): To get the negation of the give expression.

16. Find out the errors, if any, in the following C++ statements

 (i) cout<< "a=" a;

(ii) m=5, n=l2;015

(iii) cout << "x" ; <> y 

(viii) break = x 

(v) cin >> "\n" >> y ;

(vi) cout >> \n "abc"

17. What is the role of relational operators? Distinguish between == and =.

       Relational operators are used for comparing numeric data. These are binary operators. The result of any relational operation will be either True or False. In C++, True is represented by 1 and False is represented by 0. There are six relational operators in C++. They are < (less than), > (greater than), == (equal to), <= (less than or equal to), >= (greater than or equal to) and != (not equal to). Note that equality checking requires two equal symbols (==).

       Both are not same, = is an Assignment Operator it is used to assign the value of variable or expression, while == is an Equal to Operator and it is a relation operator used for comparison (to compare value of both left and right side operands).

 18.  Explain the operators used in C++ in detail.

                        Image result for operators in c++ images

           Operators are tokens constituted by predefined symbols that can trigger computer to carry out operations. The participants of an operation are called operands. An operand may be either a constant or a variable.For example, a+b triggers an arithmetic operation in which + (addition) is the operator and a, b are operands. Operators in C++ are classified based on various criteria. Based on number of operands required for the operation, operators are classified into three. They are unary, binary and ternary.

        Unary operators : A unary operator operates on a single operand. Commonly used unary operators are unary+ (positive) and unary- (negative). These are used to represent the signs of a number. If we apply unary+ operator on a signed number, the existing sign will not change. If we apply unary- operator on a signed number, the sign of the existing number will be negated.

        Binary operators: Binary operators operate on two operands. Arithmetic operators, relational              operators, logical operators, etc. are the commonly used binary operators.

        Ternary operator :Ternary operator operates on three operands. The typical example is the conditional operator (?:).

       Arithmetic operators

 Arithmetic operators are defined to perform basic arithmetic operations such as addition, subtraction, multiplication and division. The symbols used for this are +, -, * and / respectively. C++ also provides a special operator % (modulus operator) for getting remainder during division. All these operators are binary operators. Note that + and - are used as unary operators too. The operands required for these operations are numeric data. The result of these operations will also be numeric.

       Modulus operator (%)

 The modulus operator, also called as mod operator, gives the remainder value during arithmetic division. This operator can only be applied over integer operands.

          Relational operators

Relational operators are used for comparing numeric data. These are binary operators. The result of any relational operation will be either True or False. In C++, True is represented by 1 and False is represented by 0. There are six relational operators in C++. They are < (less than), > (greater than), == (equal to), <= (less than or equal to), >= (greater than or equal to) and != (not equal to). Note that equality checking requires two equal symbols (==).

          Logical operators

Using relational operators, we can compare values. Examples are 3<5, num!=10, etc. These comparison operations are called relational expressions in C++. In some cases, two or more comparisons may need to be combined. In Mathematics we may use expressions like a>b>c. But in C++, it is not possible. We have to separate this into two, as a>b and b>c and these are to be combined using the logical operator &&, i.e. (a>b)&&(b>c). The result of such logical combinations will also be either True or False (i.e. 1 or 0). The logical operators are && (logical AND), || (logical OR) and ! (logical NOT).

            Input / Output operators

 Usually input operation requires user's intervention. In the process of input operation, the data given through the keyboard is stored in a memory location. C++ provides >> operator for this operation. This operator is known as get from or extraction operator. This symbol is constituted by two greater than symbols. Similarly in output operation, data is transferred from RAM to an output device. Usually the monitor is the standard output device to get the results directly. The operator << is used for output operation and is called put to or insertion operator. It is constituted by two less than symbols.

             Assignment operator (=)

When we have to store a value in a memory location, assignment operator (=) is used. This is a binary operator and hence two operands are required. The first operand should be a variable where the value of the second operand is to be stored.

 19. Explain different types of expressions in C++.

             An expression is composed of operators and operands. The operands may be either constants or variables. All expressions can be evaluated to get a result. This result is known as the value returned by the expression. On the basis of the operators used, expressions are mainly classified into arithmetic expressions, relational expressions and logical expressions.

            Arithmetic expressions

 An expression in which only arithmetic operators are used is called arithmetic expression. The operands are numeric data and they may be variables or constants. The value returned by these expressions is also numeric. Arithmetic expressions are further classified into integer expressions, floating point (real) expressions and constant expressions.

           Integer expressions

 If an arithmetic expression contains only integer operands, it is called integer expression and it produces integer result after performing all the operations given in the expression.

          Floating point expressions (Real expressions)

An arithmetic expression that is composed of only floating point data is called floating point or real expression and it returns a floating point result after performing all the operations given in the expression.

            Relational expressions

 When relational operators are used in an expression, it is called relational expression and it produces Boolean type results like True (1) or False (0). In these expressions, the operands are numeric data.

         Logical expressions

 Logical expressions combine two or more relational expressions with logical operators and produce either True or False as the result. A logical expression may contain constants, variables, logical operators and relational operators.


20. Arrange the fundamental data types in ascending order of size.

           Int,Float,Double,Char.

21. The name given to a storage location is known as ___________.

    Ans. Memory Address

 22. Name a ternary operator in C++.

   Ans. Conditional Operator 

23. Predict the output of the following operations if x = -5 and y = 3 initially

 a. -x

b. -y

 c. -x + -y

 d. -x - y

 e. x % -11

f. x+y

g. x%y

 h. x/y

i. x * -y

j. -x %-5

Ans.      a. 5

             b. -3

           c. -(-5)+-3 = 2

            d. -(-5)-2 =2

             e. -5%-11 = -5

               f. -5+3 = -2

                g. -5%3 = -2

                h. -5/3 = -1

                 i.   -5*-3 =15

                  j. -(-5)%-5 =0