<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sum of elements in 2d array in c - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/sum-of-elements-in-2d-array-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/sum-of-elements-in-2d-array-in-c/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Fri, 03 Sep 2021 05:45:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>sum of elements in 2d array in c - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/sum-of-elements-in-2d-array-in-c/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A..?</title>
		<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/</link>
					<comments>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</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sat, 28 Aug 2021 17:26:14 +0000</pubDate>
				<category><![CDATA[Recursion and Iteration]]></category>
		<category><![CDATA[3*3 matrix addition program in c]]></category>
		<category><![CDATA[addition of two matrix in c using 2d array]]></category>
		<category><![CDATA[c functions list]]></category>
		<category><![CDATA[c program for matrix addition and subtraction using two dimensional array]]></category>
		<category><![CDATA[c programming functions exercises]]></category>
		<category><![CDATA[c programming if else example]]></category>
		<category><![CDATA[c programming if else exercises]]></category>
		<category><![CDATA[c++ if else practice problems]]></category>
		<category><![CDATA[else if ladder in c flowchart]]></category>
		<category><![CDATA[else if statement c programming]]></category>
		<category><![CDATA[function call in c]]></category>
		<category><![CDATA[function declaration in c]]></category>
		<category><![CDATA[functions in c programming with examples]]></category>
		<category><![CDATA[if else if ladder example in java]]></category>
		<category><![CDATA[if else if ladder in c++]]></category>
		<category><![CDATA[if else ladder in java]]></category>
		<category><![CDATA[if else statement c++]]></category>
		<category><![CDATA[if else statement java]]></category>
		<category><![CDATA[matrix multiplication in c]]></category>
		<category><![CDATA[nested if else c++]]></category>
		<category><![CDATA[nested if else in c programming examples]]></category>
		<category><![CDATA[nested if else in java]]></category>
		<category><![CDATA[program to sum the rows of 2X2 matrices]]></category>
		<category><![CDATA[program to sum the rows of 2X2 matrices stored in the array A]]></category>
		<category><![CDATA[Ravi and Rupali are asked to write a program to sum the rows]]></category>
		<category><![CDATA[recursion in c]]></category>
		<category><![CDATA[recursion program in c]]></category>
		<category><![CDATA[recursion vs iteration c++]]></category>
		<category><![CDATA[recursion vs iteration example]]></category>
		<category><![CDATA[sum of elements in 2d array in c]]></category>
		<category><![CDATA[sum of rows and columns in 2d array in c++]]></category>
		<category><![CDATA[sum of rows and columns in 2d array in java]]></category>
		<category><![CDATA[syntax of function in c]]></category>
		<category><![CDATA[TCS Ninja Coding Questions with Answers | TCS Ninja Coding Questions 2021 | TCS Ninja Programming MCQ Questions]]></category>
		<category><![CDATA[types of functions in cuser defined functions in c]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=2652</guid>

					<description><![CDATA[Answer : B. Code b will execute faster than a]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<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 />
Ravi writes the following code (Code A):</p>
<pre> for n = 0 to 1 
 sumRow1[n] = A[n][1] + A[n][2]
 end</pre>
<p class="color-pink">Rupali writes the following code (Code B):</p>
<pre>sumRow1[0] = A[0][1] + A[0][2] 
sumRow1[1] = A[1][1] + A[1][2]</pre>
<p>Comment upon these codes (Assume no loop unrolling done by compiler) ?</p>
<div class="row">
<div class="col-sm-6">
<p>A. Code a will execute faster than b.</p>
</div>
<div class="col-sm-6">
<p>B. Code b will execute faster than a.</p>
</div>
<div class="col-sm-6">
<p>C. Code a is logically incorrect.</p>
</div>
<div class="col-sm-6">
<p>D. Code b is logically incorrect</p>
</div>
</div>
</div>
</div>
<h3 id="answer-b-code-b-will-execute-faster-than-a"><b>Answer : </b>B. Code b will execute faster than a</h3>
<div class="subheading">
<h2 id="explanation">Explanation:</h2>
</div>
<div class="Content">
<div class="hddn">
<ul>
<li>Both codes are taking two steps of operation, so same complexity.</li>
<li>But if we consider the overhead of <a href="https://www.wikitechy.com/tutorials/c-programming/loops-in-c" target="_blank" rel="noopener">looping</a> (as it takes time to increment counter) then code b will be faster.</li>
</ul>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>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/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
