PREVIOUS QUESTIONS: SET-3

SET-1         SET-2       SET-3      SET-4       Coding  MCQs

SET 3:
Programming MCQ
1. Eesha is developing an IP telephony software in which the audio is encoded and transmitted by the sender as network packets through a communication channel. At the other end these packets are assembled and processed further.eesha recognizes that there maybe a very large number of packets this number is unknown nd which will be processed while more packets are being received .assume that the packets arrive in right order .what data structure should eesha use?
a. Array
b. List
c. Queue
d. Stack
Answer: List
2. A structure in C language is
a. System defined data type that holds predefined collection of data types
b. User defined data type holding similar or dissimilar data types
c. Another name for union data type
d. A collection of similar user defined data type
Ans : User defined data type holding similar or dissimilar data types

1) The full set of operations of stack are
a)push and pop
b)push and pop remove substitute
c)remove pus and pop
d)delete add push and pop
   2) the default return type of main()__________

3) which of the following is syntax for command line argument?
a) int main(int var, char *varg[])
b)int main(char * argv[],int argc())
c) none of the mentioned
4) while hearing song esha returns from from to back in mobile phone. This is example for ________data structure
a)stack
b)queue
c)linked list

Question 5
1. The program will recieve 3 English words inputs from STDIN
1.    These three words will be read one at a time, in three separate line
2.    The first word should be changed like all vowels should be replaced by $
3.    The second word should be changed like all consonants should be replaced by #
4.    The third word should be changed like all char should be converted to upper case
5.    Then concatenate the three words and print them
Other than these concatenated word, no other characters/string should or message should be written to STDOUT
For example if you print how are you then output should be h$wa#eYOU.
You can assume that input of each word will not exceed more than 5 chars
Write Code for this
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *str1=malloc(sizeof(char)*256);
char *str2=malloc(sizeof(char)*256);
char *str3=malloc(sizeof(char)*256);
printf(“ENter 3 words : “);
scanf(“%s%s%s”,str1,str2,str3);

int p1=strlen(str1);
int p2=strlen(str2);
int p3=strlen(str3);
for(int i=0;i<p1;i++)
{
if(str1[i]==’a’||str1[i]==’e’||str1[i]==’i’||str1[i]==’o’||str1[i]==’u’)
{
str1[i]=’$’;
}
}
for(int i=0;i<p2;i++)
{
if(str2[i]!=’a’ && str2[i]!=’e’ && str2[i]!=’i’ && str2[i]!=’o’ && str2[i]!=’u’)
{
str2[i]=’#’;
}
}
for(int i=0;i<p3;i++)
{
str3[i]=str3[i]-32;
}

printf(“\n%s”,str1);
printf(“\n%s”,str2);
printf(“\n%s”,str3);
return 0;
}


No comments:

Post a Comment

CTS Written test results of Vijayawada, Guntur, Ongole, Godarvari Districts were out.  Tentative dates of TR and HR are 24th and 25th Nov...