{"id":2652,"date":"2021-08-28T17:26:14","date_gmt":"2021-08-28T17:26:14","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=2652"},"modified":"2021-09-03T05:45:29","modified_gmt":"2021-09-03T05:45:29","slug":"ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/","title":{"rendered":"Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A..?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<p class=\"color-pink\">Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A.<br \/>\nRavi writes the following code (Code A):<\/p>\n<pre> for n = 0 to 1 \r\n sumRow1[n] = A[n][1] + A[n][2]\r\n end<\/pre>\n<p class=\"color-pink\">Rupali writes the following code (Code B):<\/p>\n<pre>sumRow1[0] = A[0][1] + A[0][2] \r\nsumRow1[1] = A[1][1] + A[1][2]<\/pre>\n<p>Comment upon these codes (Assume no loop unrolling done by compiler) ?<\/p>\n<div class=\"row\">\n<div class=\"col-sm-6\">\n<p>A. Code a will execute faster than b.<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>B. Code b will execute faster than a.<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>C. Code a is logically incorrect.<\/p>\n<\/div>\n<div class=\"col-sm-6\">\n<p>D. Code b is logically incorrect<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 id=\"answer-b-code-b-will-execute-faster-than-a\"><b>Answer :\u00a0<\/b>B. Code b will execute faster than a<\/h3>\n<div class=\"subheading\">\n<h2 id=\"explanation\">Explanation:<\/h2>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li>Both codes are taking two steps of operation, so same complexity.<\/li>\n<li>But if we consider the overhead of\u00a0<a href=\"https:\/\/www.wikitechy.com\/tutorials\/c-programming\/loops-in-c\" target=\"_blank\" rel=\"noopener\">looping<\/a>\u00a0(as it takes time to increment counter) then code b will be faster.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer :\u00a0B. Code b will execute faster than a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16505],"tags":[16493,16494,2044,16495,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,16502,2059,2060,2061,16496,16497,16498,16476,16488,16454,16453,16499,16500,16501,1771,16431,16503],"class_list":["post-2652","post","type-post","status-publish","format-standard","hentry","category-recursion-and-iteration","tag-33-matrix-addition-program-in-c","tag-addition-of-two-matrix-in-c-using-2d-array","tag-c-functions-list","tag-c-program-for-matrix-addition-and-subtraction-using-two-dimensional-array","tag-c-programming-functions-exercises","tag-c-programming-if-else-example","tag-c-programming-if-else-exercises","tag-c-if-else-practice-problems","tag-else-if-ladder-in-c-flowchart","tag-else-if-statement-c-programming","tag-function-call-in-c","tag-function-declaration-in-c","tag-functions-in-c-programming-with-examples","tag-if-else-if-ladder-example-in-java","tag-if-else-if-ladder-in-c","tag-if-else-ladder-in-java","tag-if-else-statement-c","tag-if-else-statement-java","tag-matrix-multiplication-in-c","tag-nested-if-else-c","tag-nested-if-else-in-c-programming-examples","tag-nested-if-else-in-java","tag-program-to-sum-the-rows-of-2x2-matrices","tag-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a","tag-ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows","tag-recursion-in-c","tag-recursion-program-in-c","tag-recursion-vs-iteration-c","tag-recursion-vs-iteration-example","tag-sum-of-elements-in-2d-array-in-c","tag-sum-of-rows-and-columns-in-2d-array-in-c","tag-sum-of-rows-and-columns-in-2d-array-in-java","tag-syntax-of-function-in-c","tag-tcs-ninja-coding-questions-with-answers","tag-types-of-functions-in-cuser-defined-functions-in-c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Ravi and Rupali are asked to write a program - Recursion Program in C<\/title>\n<meta name=\"description\" content=\"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ravi and Rupali are asked to write a program - Recursion Program in C\" \/>\n<meta property=\"og:description\" content=\"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-28T17:26:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-03T05:45:29+00:00\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A..?\",\"datePublished\":\"2021-08-28T17:26:14+00:00\",\"dateModified\":\"2021-09-03T05:45:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/\"},\"wordCount\":137,\"commentCount\":0,\"keywords\":[\"3*3 matrix addition program in c\",\"addition of two matrix in c using 2d array\",\"c functions list\",\"c program for matrix addition and subtraction using two dimensional array\",\"c programming functions exercises\",\"c programming if else example\",\"c programming if else exercises\",\"c++ if else practice problems\",\"else if ladder in c flowchart\",\"else if statement c programming\",\"function call in c\",\"function declaration in c\",\"functions in c programming with examples\",\"if else if ladder example in java\",\"if else if ladder in c++\",\"if else ladder in java\",\"if else statement c++\",\"if else statement java\",\"matrix multiplication in c\",\"nested if else c++\",\"nested if else in c programming examples\",\"nested if else in java\",\"program to sum the rows of 2X2 matrices\",\"program to sum the rows of 2X2 matrices stored in the array A\",\"Ravi and Rupali are asked to write a program to sum the rows\",\"recursion in c\",\"recursion program in c\",\"recursion vs iteration c++\",\"recursion vs iteration example\",\"sum of elements in 2d array in c\",\"sum of rows and columns in 2d array in c++\",\"sum of rows and columns in 2d array in java\",\"syntax of function in c\",\"TCS Ninja Coding Questions with Answers | TCS Ninja Coding Questions 2021 | TCS Ninja Programming MCQ Questions\",\"types of functions in cuser defined functions in c\"],\"articleSection\":[\"Recursion and Iteration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/\",\"name\":\"Ravi and Rupali are asked to write a program - Recursion Program in C\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"datePublished\":\"2021-08-28T17:26:14+00:00\",\"dateModified\":\"2021-09-03T05:45:29+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/recursion-and-iteration\\\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ravi and Rupali are asked to write a program - Recursion Program in C","description":"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/","og_locale":"en_US","og_type":"article","og_title":"Ravi and Rupali are asked to write a program - Recursion Program in C","og_description":"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/","og_site_name":"Wikitechy","article_published_time":"2021-08-28T17:26:14+00:00","article_modified_time":"2021-09-03T05:45:29+00:00","author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A..?","datePublished":"2021-08-28T17:26:14+00:00","dateModified":"2021-09-03T05:45:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/"},"wordCount":137,"commentCount":0,"keywords":["3*3 matrix addition program in c","addition of two matrix in c using 2d array","c functions list","c program for matrix addition and subtraction using two dimensional array","c programming functions exercises","c programming if else example","c programming if else exercises","c++ if else practice problems","else if ladder in c flowchart","else if statement c programming","function call in c","function declaration in c","functions in c programming with examples","if else if ladder example in java","if else if ladder in c++","if else ladder in java","if else statement c++","if else statement java","matrix multiplication in c","nested if else c++","nested if else in c programming examples","nested if else in java","program to sum the rows of 2X2 matrices","program to sum the rows of 2X2 matrices stored in the array A","Ravi and Rupali are asked to write a program to sum the rows","recursion in c","recursion program in c","recursion vs iteration c++","recursion vs iteration example","sum of elements in 2d array in c","sum of rows and columns in 2d array in c++","sum of rows and columns in 2d array in java","syntax of function in c","TCS Ninja Coding Questions with Answers | TCS Ninja Coding Questions 2021 | TCS Ninja Programming MCQ Questions","types of functions in cuser defined functions in c"],"articleSection":["Recursion and Iteration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/","name":"Ravi and Rupali are asked to write a program - Recursion Program in C","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"datePublished":"2021-08-28T17:26:14+00:00","dateModified":"2021-09-03T05:45:29+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"This is the programming questions and answers section on recursion and iteration with explanation for various interview, competitive exam.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/recursion-and-iteration\/ravi-and-rupali-are-asked-to-write-a-program-to-sum-the-rows-of-2x2-matrices-stored-in-the-array-a\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=2652"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2652\/revisions"}],"predecessor-version":[{"id":2667,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/2652\/revisions\/2667"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=2652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=2652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=2652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}