282 Programming and Data Structures
fo r (t=l;x[t]!=0& & t<=strlen(x);t+=2)
printf ("% c",x [t]);
}
a) 1234567890
c) alb2c3d4e5f6g7h8i9j0
b) abcdefghij
d) none of the above
5) What will be the output of the following program?
# include <stdio.h>
# include <conio.h>
void main ()
{
char txt [] ="123450abcdef";
clrscr ();
printf ("% s ”,txt);
}
a) 12345
c) 123450abcdef
b) abcdef
d) none of the above
6) What will be the output of the following program?
# include <stdio.h>
# include <conio.h>
void main ()
{
char txt [] ="ABCDEFOGHIJKL" ;
clrscr ();
printf ("% s % d ”,txt,sizeof(txt));
}
a) ABCDEF 14 b) ABCDEF0GHIJKL 14
c) ABCDEF 7 d) none of the above
C] Attem pt the following program s.
1) Write a program to arrange a set of fruit names given below in descending order (reverse
alphabetic). (Mango, Banana, Apple, Orange, Graphs, Coconut, Water melon and Papaya).
2) Write a program to arrange the following names in alphabetic order. The sorting is to be done on
the first three characters of the first name.
( Ashok, Alok, Akash, Am it, Am ol, An il, Ashish & Anand)
3) Write a program to enter some text and display the text in reverse order. (Example: "I am happy"
will be displayed as "happy am I."
4) Write a program to enter five full names of persons. Display their names, initials, and last
names.
5) Write a program to enter text through keyboard. Convert first character of each word in capital
and display the text.
6) Write a program to enter some text through the keyboard. Insert dot ( .) after every three words
in the text. The first character after every dot should be converted to capital.
7) Write a program to enter some text through the keyboard. Count the number of words that starts
from 'w'. Display such words and count them.
8) Write a program to print the entered word with all possible combinations.
9) Write a program to encrypt the text "INDIA." The output should be "KPFKC". ( ' A' is to be
replaced with 'C ', %B' with %D' and 'C ' with 'E ' and so on.)
10) Write a program to dycrypt the text "KPFKC" to get original string "INDIA".