WORKSHEET DATA REP AND INTRO C++

4
WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++) Neena Sharma Page 1 1. Describe the sign & magnitude representation. 2. What are the bases of decimal, octal, binary and hexadecimal numbers systems? 3. How many numbers can be represented by N bit word? Explain your answer. 4. What is Two‟s compliment of a number & how can it be calculated? Express –17 in two‟s compliment form. 5. Why is the decimal system described as a positional-value system? 6. Discuss the representation of characters in memory. 7. What does MSB and LSB stands for? 8. I. Convert 2C916 to decimal II. Convert 22.2510 to Binary III. Convert 11110110 to hexadecimal IV. Convert 111110001111 to Octal 9. What is byte? 10. Define ; ASCII, ISCII, UNICODE 11. Convert the followings: i. 101001.0101 to decimal ii. (236)8 to Binary iii. (266)10 to Hexadecimal iv. (AF2)16 to Binary v. 0101110.1010110 to Hexadecimal 12. What will be the sizes of the following constants: „x‟, “y”, “Guneet‟s”, „” „? 13. How are single line and multi line block comments written? 14. What is equal to = sign used for ? 15. Point out the errors in the following program. include < iostream.h > int main( ) { cout << find me ; return 0 } 16. What kinds of constants are the following? 14, 011, 0X2A, 17, 014, 0XBC 17. Find the syntax error in the following code: main() { int a, b : cin >> a >> b; cout << a + b, return 0 } 18. State the reason why the code given below is illegal. And how can we correct it? main()

description

Question bank on Data Representation and Introduction to C++

Transcript of WORKSHEET DATA REP AND INTRO C++

  • WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++)

    Neena Sharma Page 1

    1. Describe the sign & magnitude representation.

    2. What are the bases of decimal, octal, binary and hexadecimal numbers systems?

    3. How many numbers can be represented by N bit word? Explain your answer.

    4. What is Twos compliment of a number & how can it be calculated? Express 17 in twos compliment

    form.

    5. Why is the decimal system described as a positional-value system?

    6. Discuss the representation of characters in memory.

    7. What does MSB and LSB stands for?

    8. I. Convert 2C916 to decimal

    II. Convert 22.2510 to Binary

    III. Convert 11110110 to hexadecimal

    IV. Convert 111110001111 to Octal

    9. What is byte?

    10. Define ; ASCII, ISCII, UNICODE

    11. Convert the followings:

    i. 101001.0101 to decimal

    ii. (236)8 to Binary

    iii. (266)10 to Hexadecimal

    iv. (AF2)16 to Binary

    v. 0101110.1010110 to Hexadecimal

    12. What will be the sizes of the following constants: x, y, Guneets, ?

    13. How are single line and multi line block comments written?

    14. What is equal to = sign used for ?

    15. Point out the errors in the following program.

    include < iostream.h >

    int main( )

    {

    cout > a >> b;

    cout

  • WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++)

    Neena Sharma Page 2

    {

    int i=j=k=0;

    }

    19. Find errors in the following code:

    int main()

    {

    cout > num

    sqr = num * num

    cout

  • WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++)

    Neena Sharma Page 3

    c. Print the string February on the screen.

    d. Increase the value of the variable count by 2;

    e. Assign the value represented by the formula A2+B2+C to the variable X

    f. Assign value 3 to the variable c1,c2,c3.

    g. Print the value of c1,c2,c3 in a single line.

    h. Print the value c1,c2,c3 in three separate lines.

    i. Print the value of c1,c2,c3 in one line with some space between them.

    j. Print the statement Hello1 world in the following format:

    Hello!

    world

    34. What are literals in C++?How many types of literals are allowed in C++/

    35. What value will be stored in different variables when the following C++ statements are executed?

    int i =10;

    int j, k,l,m, n;

    j=i+5;

    k=i+j/5;

    l=k+1;

    m=l+1-i;

    n=k+m*I;

    cout

  • WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++)

    Neena Sharma Page 4