{"id":101528,"date":"2022-10-26T15:20:21","date_gmt":"2022-10-26T15:20:21","guid":{"rendered":"https:\/\/assignmenttutors.net\/blog\/what-is-the-output-computer-science-homework-help-2\/"},"modified":"2022-10-26T15:20:21","modified_gmt":"2022-10-26T15:20:21","slug":"what-is-the-output-computer-science-homework-help-2","status":"publish","type":"post","link":"https:\/\/assignmenttutors.net\/blog\/what-is-the-output-computer-science-homework-help-2\/","title":{"rendered":"What is the output | Computer Science homework help"},"content":{"rendered":"<div>\n<p>\u00a0\u00a0<\/p>\n<p>1 ) What is the output for the following:<\/p>\n<p>for (int x = 1; x &lt;= 7; x++)<\/p>\n<p>cout &lt;&lt; \u201cGooDByen\u201d;<\/p>\n<p>2 ) What is the output for the following:<\/p>\n<p>for (int x = 1; x &lt;= 7; x++)<\/p>\n<p>cout &lt;&lt; \u201cGooDBye\u201d;<\/p>\n<p>3 ) What is the output for the following:<\/p>\n<p>for (int x = 1; x &lt;= 3; x++)<\/p>\n<p>{<\/p>\n<p>for (int y =1; y &lt;= 4; y++)\u00a0<\/p>\n<p>cout &lt;&lt; (( x+y)*2)&lt;&lt;endl;<\/p>\n<p>}<\/p>\n<p>4 ) This is an example of using pointers in code\u00a0<\/p>\n<p>What is the output for the following:<\/p>\n<p>char x[ ] = {\u201cHave a Nice DAY\u201d};<\/p>\n<p>char *ptr;<\/p>\n<p>ptr = x; OR ptr=&amp;x[0];<\/p>\n<p>while (*ptr != \u2018n\u2019)<\/p>\n<p>{<\/p>\n<p>if (*ptr = = \u2018a\u2019<\/p>\n<p>cout &lt;&lt; \u201cYou Have a Hitn\u201d;<\/p>\n<p>ptr++;<\/p>\n<p>}<\/p>\n<p>5 ) This is an example of using pointers in code\u00a0<\/p>\n<p>What is the output for the following:<\/p>\n<p>int p [ 5 ]= {100,200,300,400,500},*q,x;<\/p>\n<p>q = p[ 4 ];<\/p>\n<p>*q = 250;<\/p>\n<p>p [ 1 ] = *q + 50;<\/p>\n<p>q = p [2 ];<\/p>\n<p>q++;<\/p>\n<p>*q = *(q-1) +50;<\/p>\n<p>q=&amp;p[0];<\/p>\n<p>for (int x = 4; x &gt;= 0; x&#8211;)<\/p>\n<p>cout &lt;&lt; *(q + x)&lt;&lt;endl;<\/p>\n<p>6 ) This is an example of using pointers in code, HOW WOULD YOU CHANGE THE CODE?\u00a0<\/p>\n<p>Change Array notation (use of index) to pointer notation:<\/p>\n<p>a) int x;<\/p>\n<p>int arrays [ 5 ]= {100,200,300,400,500};<\/p>\n<p>for (int x = 0; x &lt; 5; x++)<\/p>\n<p>cout &lt;&lt; arrays [ x ]&lt;&lt; \u2018 \u2018;<\/p>\n<p>#include &lt;iostream.h&gt;<\/p>\n<p>void swap(float&amp;, float&amp;); \/\/ function receives 2 references<\/p>\n<p>int main()<\/p>\n<p>{<\/p>\n<p>float firstnum = 20.5, secnum = 6.25;<\/p>\n<p>cout &lt;&lt; &#8220;The value stored in firstnum is: &#8221; &lt;&lt; firstnum &lt;&lt; endl;<\/p>\n<p>cout &lt;&lt; &#8220;The value stored in secnum is: &#8220;&lt;&lt; secnum &lt;&lt; &#8220;nn&#8221;;<\/p>\n<p>swap(firstnum, secnum); \/\/ call the function with references<\/p>\n<p>cout &lt;&lt; &#8220;The value stored in firstnum is now: &#8220;<\/p>\n<p>&lt;&lt; firstnum &lt;&lt; endl;<\/p>\n<p>cout &lt;&lt; &#8220;The value stored in secnum is now: &#8220;<\/p>\n<p>&lt;&lt; secnum &lt;&lt; endl;<\/p>\n<p>return 0;<\/p>\n<p>}<\/p>\n<p>void swap(float &amp;num1, float &amp;num2)<\/p>\n<p>{<\/p>\n<p>float temp;<\/p>\n<p>temp = num1; \/\/ save num1&#8217;s value<\/p>\n<p>num1 = num2; \/\/ store num2&#8217;s value in num1<\/p>\n<p>num2 = temp; \/\/ change num2&#8217;s value<\/p>\n<p>return;<\/p>\n<p>}<\/p>\n<h2>STACK QUEUE REVIEW<\/h2>\n<p>Use the Stack and Queue class declaration\/implementation as in Programs 15.1 and 15.3 of Bronson or your text. Show what is written\/output by the following segments of code.<\/p>\n<p>Show what is written\/output by the following segments of code.<\/p>\n<p>Show what is written\/output by the following segments of code.<\/p>\n<p>Show what is written\/output by the following segments of code.<\/p>\n<p><u><strong>Recursion Review<\/strong><\/u><\/p>\n<p>cin&gt;&gt; : is input from the key board.\u00a0<\/p>\n<p>Problem1: Look at the following program, the input will be 19, 23, 55, 88, m one at a time.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><strong>What is the output?<\/strong><\/p>\n<p><strong>What is the Base Case?<\/strong><\/p>\n<p><strong>What is the recursive Case?<\/strong><\/p>\n<p>Using the LINKED LIST do the following:<\/p>\n<p>\/\/ This program demonstrates the LINKED LIST member methods\/functions<\/p>\n<p>\/\/ append; adds a element<\/p>\n<p>\/\/ This is a SORTED linked list, insert; puts the element in the location to keep order in \/\/ the sort\u00a0<\/p>\n<p>\/\/ delete; removes the element stated.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0 1 ) What is the output for the following: for (int x = 1; x &lt;= 7; x++) cout &lt;&lt; \u201cGooDByen\u201d; 2 ) What is the output for the following: for (int x = 1; x &lt;= 7; x++) cout &lt;&lt; \u201cGooDBye\u201d; 3 ) What is the output for the following: for (int x [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-101528","post","type-post","status-publish","format-standard","hentry","category-education"],"_links":{"self":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/101528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/comments?post=101528"}],"version-history":[{"count":0,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/posts\/101528\/revisions"}],"wp:attachment":[{"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/media?parent=101528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/categories?post=101528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/assignmenttutors.net\/blog\/wp-json\/wp\/v2\/tags?post=101528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}