You are on page 1of 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 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 << 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()
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 << Enter number;
cin >> num
sqr = num * num
cout << the square is<< sqr;

20. Do the following code segments perform the same job:
int a = 10;
int a(10);

21. What does the modulo operator % do? What is the result of the expression 22.6%5.2?
22. Explain the terms: tokens, keywords and identifiers.
23. Give the output of the following program segment:
int i=100, j=9;
cout<<i/j<<endl
24. What is the difference between 24L and 24?
25. Define the term variable. Name the two values associated with the symbolic variable.
26. In how many ways a variable can be declared?
27. Define fundamental data type. Name five fundamental data types.
28. What are the advantages and disadvantages of floating-point number over integers?
29. Consider the following two C++ statements. Are they same? Comment.
char ch=67;
char ch=C;
30. What type of declaration the following program is using?

void main()
{
int radius=10, height=20, volume, totalsurfacearea;
volume = (22/7)*radius*radius*height;
totalsurfacearea = 2*(22/7)*radius*(radius+height);
..
}
31. WAP to convert a given number of days into years, weeks and days? (USE/ & % OPERATOR)
32. WAP that accepts a character between a to t and prints next 3 character?
33. Write the statements for each situation described below:
a. Assign a value 2 to the variable A;
b. Assign the value represented by variable N to variable N1.
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 A
2
+B
2
+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<<i<<\n<<k<<\n<<l<\n<<m<<\n<<n;

36. What is the role of main() in c++ program.
37. What are the rules to be followed while naming the identifier?
38. Why is char often treated as integer data type?
39. What are escape sequences?
40. List three types of integer supported by C++.
41. List the different types of float variables in C++?
42. List different types of errors.
43. What is role of main() in c++ program?
44. What are C++ comments? What is the purpose of comments and indentation?
45. How / operator is different from % operator?
46. Evaluate the following, where p, q are integers and r, f are floating point numbers.
The value of p=8, q=4 and r=2.5
(i) f = p * q + p/q
(ii) r = p+q + p % q
47. How can you give a single line and multiline comments in C++ explain with suitable examples.
48. Classify the following variable names of c++ into valid and invalid category
(i) 1no (ii) num 1 (iii) num (iv) num1num (v) num+1 (vi) num.1
49. WAP to calculate area of triangle.
50. If value is an identifier of type int and is holding value 200, is the following statement correct ?
Char code=value;
51. An unsigned int can be twice as large as the signed int. Explain how .
WORKSHEET -1 (NUMBER SYSTEM & INTRO TO C++)

Neena Sharma Page 4

You might also like