
CBSE Guess > Papers > Important Questions > Class XI > 2010 >Computer Science >Computer Science By Mr. Ravi Kiran
CBSE CLASS XI
Q.6. Explain any two string handling functions with syntax and examples.
a) String functions:Function Description Example
1. strcat – string concatenation.
char *strcat (char *str1, const
char *str2)
This function concatenates a
copy of str2 to str1 and
terminates str1 with a null. str1
should be large enough to hold
both its original contents and
those of str2
char *str1=”One”;
char *str2=”Two”;
strcat(str2,str1);
cout<<str2;
(It will print “TwoOne”).
2. strcmp – string compare
int strcmp (const char *str1,
const char *str2)
This function alphabetically
compares two strings and
returns –ve value if str1 is less
than str2, 0 if str1 is equal to
str2, and >0 (+ve value) if str1
is greater than str2.
char *str1=”Ace”;
char *str2=”Bag”;
strcmp(str2,st1) returns +ve
value (>0 value) but strcmp
(str1,str2), return –ve value.
Q.3. strcpy – string copy
char *strcpy(char *str1, const
char *str2)
Copies the contents of str2 into
str1
char *str1=”Ace”;
char *str2=”Bag”;
strcpy(str1,str2);
cout<<str1;
(It will print “Big”);
4 strlen – string length
int strlen(char *str)
Returns the length of the null
terminated string pointed to by
str. The null is not counted.
strlen(“Raju”) would give
VI. Q.1. (AC.20)16= (?)2= (?)8
a) (AC.20)16
Binary equivalent of A = 1010
Binary equivalent of C = 1100
Binary equivalent of 2 = 0010
Binary equivalent of 0 = 0000
So, (AC.20)16 = (10101100.00100000) 2
(10101100.00100000) 2 = = (254.100) 8
Q.2. (4A56)16= (?)10= (?)8 2
a) (4A56)16 = 4 X 163 + 10 X 162 + 5 X 161 + 6 X 160
=4 X 4096 + 10 X 256 + 5 X 16 + 6 X 1
= 16384 + 2560 + 80 + 6
= (19030) 10
(4A56)16 =(0100 1010 0101 0110) 2
= = (45126) 8
Q.3. Which of the following are hardware and software?
(i) Capacitor (ii)Intenet Explorer (iii)Hard disk (iv)UNIX
a) (i) Capacitor - Hardware
(ii) Internet Explorer – Software
(iii) Hard Disk – Hardware
(iv) UNIX - Software
Q.4. Find the 1’s and 2’s complement of 128.
a) Binary Equivalent of 128 = 10000000
1’s Complement of 128 = 01111111
+1
2’s Complement of 128 = 10000000
Q. 5. Define the following:
i)DRAM
ii) Serial Port
a) (i) DRAM: Dynamic Random Access Memory. DRAM consists of a transistor
and a capacitor that’s capable of storing an electric charge. Depending on the
switching action of the transistor, the capacitor either contains no charge(0) or
does hold a charge(1). DRAM is volatile ie contents are lost in the event of power
failure. Regenerator circuits are there to refresh the memory.
(ii) Serial Port (COM or RS232C Ports): The serial port transfers data serially a bit
at a time. Serial ports come in the form of 9 pin or 25 pin male connector.
Paper By Mr. Ravi Kiran
Email Id :[email protected]
|