The Gateway to Computer Science Excellence
+10 votes
4.5k views

Let $A(1:8, -5:5, -10:5)$ be a three dimensional array. How many elements are there in the array $A$?

  1. $1200$
  2. $1408$
  3. $33$
  4. $1050$
in DS by Boss (30.9k points) | 4.5k views

3 Answers

+25 votes
Best answer
I am just attempting it not sure

Here i think they have specified the size

So 1:8 mean 8 elements ( both are inclusive  )

(-5 : 5 ) mean 11 elements

(-10 : 5 ) mean 16 elements

So no of elements will be ( just like Multidimensional array will be ) 8*11*16=1408

so option b
by Loyal (9.9k points)
selected by
0
Whats (minus) indicates?
0

@smartmeetstarting index of array is some negative number, as per C standards it starts at 0 but neednot be the same case in all other programming languages.

Here -5:5 means, index range here is : { -5,-4,-3,-2,-1,0,1,2,3,4,5 } and it's equal to 11 elements.

+4 votes
ul = upper limit

ll=lower limit

 

(ul3-ll3+1) x  (ul2-ll2+1) x(ul1-ll1+1) =(8-1+1) x( 5- (-5)+1)  x   (5 +10+1) =1408
by (319 points)
0 votes
1408
by (19 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,391 answers
198,589 comments
105,442 users