What is a output of a program to input string and to print the alternate characters?

1 Answer

Answer :

#include#includestd::ostream& alternate (std::ostream& os, conststd::string& str) {for (size_t index=0; index<str.size(); index+=2) os <<str[index];return os;}int main (void) {std::string test {"The quick brown fox jumps over the lazydog"};alternate (std::cout, test);std::cout << std::endl;}Output:Teqikbonfxjmsoe h aydg

Related questions

Description : One method of troubleshooting digital circuits in a console is to ___________. A. supply alternate logic levels at the input(s) and test for change of state conditions at the output B. ground all ... output D. vary each input smoothly from 0-10 volts and test for similar variance at the output

Last Answer : Answer: A

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : A bit-stuffing based framing protocol uses an 8-bit delimiter pattern of 01111110. If the output bit-string after stuffing is 01111100101, then the input bit-string is a. 0111110100 b. 0111110101 c. 0111111101 d. 0111111111

Last Answer : b. 0111110101

Description : Write a program to accept a string as input from user and determine its length. [Don’t use built in library function strlen()]

Last Answer : #include #include void main(){ char str[50]; int i, len=0; clrscr(); printf("Enter a string"); scanf("%s",&str); for(i=0; str[i]!='\0'; i++){ len++; } printf("The length of string is %d",len); getch(); }

Description : Write a program to accept the value of year as input from the keyboard & print whether it is a leap year or not. 

Last Answer : #include #include void main() { int year; clrscr(); printf("Enter year"); scanf("%d",&year); if(year%4==0) { printf("Year %d is a leap year",year); } else { printf("Year %d is not a leap year",year); } getch(); }

Description : PHP Gurus: What is the easiest way to generate a specified length string of random alpha characters?

Last Answer : answer:Well, this code will spit stuff out per your “For example” Not sure what alpha characters are though… Check it here.

Description : The value for alt attribute is a text string of upto ………….. characters. -Technology

Last Answer : The value for alt attribute is a text string of upto1024characters.

Description : Python - How to replace all non-alphanumeric characters in a string -Web-Development

Last Answer : answer:

Description : Pythonic way to convert a string into a list of characters -Web-Development

Last Answer : answer:

Description : Is a concern that two or more characters in string most clearly have in common?

Last Answer : Poverty (APEX)

Description : To represent addresses in assembly language we use: a. String characters b Arrays c. Structure d Enum

Last Answer : a. String characters

Description : Which command is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric characters? A. cat emp[!0-9] B. more [emp][!0-9] C. cat emp[x-z]

Last Answer : A. cat emp[!0-9]

Description : Which command is used to copy all files having the string chap and any two characters after that to the progs directory? A. cp chap?? progs B. cp chap* progs C. cp chap[12] /progs/*.*

Last Answer : A. cp chap?? progs

Description : Design black box test suits for a function that checks whether a character or string upto ten characters in a palindrome?

Last Answer : Ans Following may be the test cases: - Try with Even number of characters (MALAYALAM) - Try with Odd number of characters (ADDA) - Try with maximum length of string The following are negative test ... come for the following) - Try with empty string - Try with numbers - Try with special characters

Description : The control string in C++ consists of three important classifications of characters (A) Escape sequence characters, Format specifiers and Whitespace characters (B) Special characters, White-space ... and Non-white space characters (D) Special characters, White-space characters and Format specifiers

Last Answer : (C) Format specifiers, White-space characters and Non-white space characters

Description : The number of strings of length 4 that are generated by the regular expression (0|∈) 1+2* (3|∈), where | is an alternation character, {+, *} are quantification characters, and ∈ is the null string, is: (A) 08 (B) 10 (C) 11 (D) 12

Last Answer : (D) 12

Description : What does the following command do? grep −vn abc x (A) It will print all of the lines in the file x that match the search string abc (B) It will print all of the lines in file x that do not ... (D) It will print the specific line numbers of the file x in which there is a match for string abc

Last Answer : (A) It will print all of the lines in the file x that match the search string “abc”

Description : Which is the incorrect statement about Carnot cycle?  A. It is used as the alternate standard of comparison of all heat engines.  B. All the heat engines are based on Carnot cycle.  C. It provides concept of maximising work output between the two temperature limits.  D. all of the above

Last Answer : Answer: B

Description : What is input / output control program ?

Last Answer : The input / output control program accepts the input device for faster data processing and keeps these devices in line with the CPU to speed up the output to the output device and sends a message to the user in case of difficulty.

Description : What do you call the translator which takes assembly language program as input & produce machine language code as output? A) Compiler B) Interpreter C) Debugger D) Assembler

Last Answer : Answer : D

Description : ____________ is the raw material used as input and __________ is the processed data obtained as output of data processing. a) Data, Instructions b) Instructions, Program c) Data, Program d) Program, Code

Last Answer : Answer: a Explanation: Data can be assumed as a raw material which , in turns after processing gives the desired output in the form of instructions. Further, a set of ordered and meaningful instructions is known as a program

Description : A memory in CPU that holds program instructions, input data, intermediate results and the output information produced during processing is __________ A. System B. Primary Memory C. Secondary Memory D. None of the above

Last Answer : B. Primary Memory

Description : We use the output of the requirement analysis, the requirement specification as the input for writing :- a) User Acceptance Test Cases b) Integration Level Test Cases c) Unit Level Test Cases d) Program specifications

Last Answer : a) User Acceptance Test Cases

Description : Artificial intelligence is A . It uses machine-learning techniques. Here program can learn From past experience and adapt themselves to new situations B. Computational procedure that takes some ... performs tasks that would require intelligence when performed by humans D . None of these

Last Answer : C. Science of making machines performs tasks that would require intelligence when performed by humans

Description : State True or False. i) In spooling high speed device like a disk is interposed between running program and low-speed device in Input/output. ii) By using spooling for example instead of writing directly to a printer, ... ii-False B) i-True, ii-True C) i-False, ii-True D) i-False, ii-False

Last Answer : B) i-True, ii-True

Description : The time between program input and output is called (1) Turn around time (2) Waiting time (3) Execution time (4) Delay time

Last Answer : Turn around time

Description : Write a C language program to operate port 0 and port 2 as output port and port 1 and port 3 as input port.

Last Answer : #include void main (void ) { unsigned char X,Y P0=0X00; // P0 as output port P2=0X00;// P2 as output port P1=0XFF;//P1 as input port P3=0XFF;// P3 as input port while(1) { X= P1; Y=P3; P0=X; P2=Y; }//end of while }//end of main

Description : Which of the following derivations does a top-down parser use while parsing an input string ? The input is scanned from left to right. (A) Leftmost derivation (B) Leftmost derivation traced out in reverse (C) Rightmost derivation traced out in reverse (D) Rightmost derivation

Last Answer : (A) Leftmost derivation

Description : Printer resolution is a numerical measure of print quality that is measured in _______ A. Pages Per Minute (PPM) B. Lines Per Minute (LPM) C. Characters Per Second (CPS) D. Dots Per Inch (DPI)

Last Answer : D. Dots Per Inch (DPI)

Description : _________ printers print the characters without using ribbon and it can print a complete page at a time. A. Impact B. Non Impact C. Both (A) and (B) D. None of the Above

Last Answer : B. Non Impact

Description : __________ printers print the characters by striking them on the ribbon which is then pressed on the paper. A. Impact B. Non Impact C. Both (A) and (B) D. None of the Above

Last Answer : A. Impact

Description : The output of executing string.ascii_letters can also be achieved by: a) string.ascii_lowercase_string.digits b) string.ascii_lowercase+string.ascii_upercase c) string.letters d) string.lowercase_string.upercase

Last Answer : d) string.lowercase_string.upercase

Description : Which of the following input device is used in Banks to read magnetised characters on a Cheque? A. OCR B. MICR C. Bar Code reader D. Magnetic Stripe reader

Last Answer : B. MICR

Description : Is it compulsory to write String args[] when running a program in BlueJ?

Last Answer : A: No it is not compulsory when we are running it in BlueJ. But normally (in all other cases) it is always better to have it, as the JVM looks for the main method with a String array as a parameter.

Description : What would happen if "String[]args" is not included as argument in the main method. A) No error B) Compilation error C) Program won't run D) Program exit

Last Answer : C) Program won't run

Description : Write a program which concate and reverse string by using pointer to string.

Last Answer : #include #include void main()  { char str1[20], str2[20], rev[20],*p1,*p2; int cnt=0; clrscr(); coutstr2;  p1=&str1[0];  p2=&str2[0]; while(*p1!='\0')  { p1++;  } while(*p2!='\0')  { *p1=*p2; p1++; p2++;  }  *p1='\0'; cout

Description : Write a program to find whether the string is palindrome or not.

Last Answer : #include #include #include void main() { char str1[10],str2[10]; int c; clrscr(); coutstr1; strcpy(str2,str1); strrev(str2); cout

Description : Write a program to copy content of one string to another string using pointer to string.

Last Answer : #include<iostream.h> #include<conio.h> void main() { char str1[10],str2[10],*p1,*p2; clrscr(); cout<<"\n Enter a String"; cin>>str1; p1=&str1[0]; p2= ... } *p2='\0'; cout<<"Copied String is "<<str2; getch(); }

Description : Write a program to find length of a string using pointer to string.

Last Answer : #include<iostream.h> #include<conio.h> void main() { char str1[10],*ptr; int len=0; cout<<"enter string:"; cin>>str1; ptr=&str1[0]; while(*ptr!='\0 ... +; } cout<<"\nThe Length of a string is"<<len; getch(); }

Description : Write a program using concept of pointers to string for performing following operations: (i) String concatenation (ii) String comparisons

Last Answer : (i) Program to implement String Concatenation: #include #include void main() { char s1[50],s2[30],*p,*q; clrscr(); couts1>>s2; p=s1; q=s2; while(*p!=NULL) { p++; } while(*q!=NULL) { *p=*q; p++; q++; } *p='\0'; cout

Description : Write a program in C++ to accept a string from a user and display its reverse using pointer.

Last Answer : #include<iostream.h> #include<conio.h> #include<string.h> void main() { char str[20],*ptr; int l; clrscr(); cout<<"\n Enter a string : "; cin>>str; l=strlen(str); ... (l!=0) { ptr--; cout<<*ptr; l--; } getch(); }

Description : Consider a program that consists of 8 pages (from 0 to 7) and we have 4 page frames in the physical memory for the pages. The page reference string is :  1 2 3 2 5 6 3 4 6 3 7 3 1 5 3 6 3 4 2 4 3 4 5 ... to fill available page frames with pages): (A) 9 and 6 (B) 10 and 7 (C) 9 and 7 (D) 10 and 6

Last Answer : (B) 10 and 7

Description : ECE Board Exam March 1996 What is the transmission rate of a system for transmitting the output of a microcomputer to a line printer operating at a speed of 30 lines/minute? Assume that the line printer has 8 bits ... and prints out 80 characters/line. A. 800 bps B. 400 bps C. 320 bps D. 640 bps

Last Answer : C. 320 bps

Description : What output device expresses coded characters as hard copy (paper documents)?

Last Answer : Printers.

Description : Python : How to flush the output of print statement and see the content of a live file -Web-Development

Last Answer : answer:

Description : Which printers produce output by mechanical contact between the print head and paper? A. Impact B. Non-impact C. Both (A) and (B) D. None of the Above

Last Answer : A. Impact

Description : The % symbol has a special use in a print statement. Define How would you place this character as part of the output on the screen?

Last Answer : You can do this by using %% in the printf statement. For example, you can write printf(“10%%”) to have the output appear as 10% on the screen.

Description : System.out.print(“BEST “); System.out.println(“OF LUCK”); Choose the correct option for the output of the above statements: (i) BEST OF LUCK (ii) BEST OF LUCK

Last Answer : Ans. (i) is the correct output. System.out.print() does not add a new line at the end because of which ‘OF LUCK’ gets printed on the same line as ‘BEST’.

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} a.clear() print(a) a) None b) { None:None, None:None, None:None} c) {1:None, 2:None, 3:None} d) { }

Last Answer : d) { }