Problems on Average Questions with Solutions PDF

Average Question Problems

Basic Average Formula and Tricks


For Example : Find the average of all numbers between 5 and 49 which are divisible by 5. 
Solutions : Number are 5, 10, 15, 20, 25, 30, 35, 40, 45, These numbers are divided by 5.

Average Of numbers =5+10+15+20+25+30+35+40+45  =  225
99



For Example : The average of 11 numbers is 30. If the average of first six numbers is 17.5 and that of last six is 42.5, then what is the sixth number? 
Solutions:   11 Number's Average is 30 [ Given ]
Sum of 11 Number's is 11 x 30 = 330
Average of first six numbers is 17.5 [ Given ] , so Sum of First 6 Number's is 17.5 x 6 = 105
Average of last six is 42.5 [ Given ] , so Sum of Last 6 Number's is 42.5 x 6 = 255
⇒ Sixth Number = ( Sum of First 6 Number's + Sum of Last 6 Number's ) - Sum of 11 Number's
⇒ Hence the Sixth Number is (105 + 255 ) - 330 = 30



For Example : A person covers a distance of 50 km from P to Q at a speed of 30 km/hr and returns from Q to P at a speed of 40 km/hr. Find the average speed of person. 
Solutions:   Distance of 50 km from P to Q at a speed of 30 km/hr, Returns from Q to P at a speed of 40 km/hr 
Average Speed =2 x 30 x 40  =  2400
30 + 4070
: : So the Average speed of the person = 34.28 km/hr

  When new member is added or replaced by other member in the group.
 For Example : The average weight of 8 person's increases by 2.5 kg when a new person comes in place of one of them weighing 65 kg. What might be the weight of the new person?
Solutions:  Total weight increased = (8 x 2.5) kg = 20 kg.
Weight of new person = (65 + 20) kg = 85 kg.

Average formula for n natural number = (n + 1) / 2

Average formula of n even numbers = (n + 1)
If number value increase or decrease by X, then the average also increase or decrease by A.

In AP ( Arithmetic Progression ), if number of terms are

i) Odd – Average is the middle term.

ii) Even – Average is the average of two middle terms.



Objective Question On Average Problem




  1. The average marks scored by Ganesh in English, Science, Mathematics and History is less than 15 from that scored by him in English, History, Geography and Mathematics. What is the difference of marks in Science and Geography secured by him?
    1. A. 40     
    2. B. 50      
    3. C. 60        Correct Answer
    4. D. Data inadequate      
  2.  

    A Mathematics teacher tabulated the marks secured by 35 students of 8th class. The average of their marks was 72. If the marks secured by Beans were written as 36 instead of 86 then find the correct average marks up to two decimal places.
    1. A. 73.41     
    2. B. 74.3      
    3. C. 72.43      
    4. D. 73.43        Correct Answer
  3.  

    The average age of a husband and wife was 23 when they were married 5 years ago. The average age of the husband, the wife and a child who was born dining the interval, is 20 years now. How old is the child now?
    1. A. 9 months     
    2. B. 1 year      
    3. C. 3 years      
    4. D. 4 years        Correct Answer
  4.  

    The average of four consecutive even numbers is one-fourth of the sum of these numbers. What is the difference between the first and the last number?
    1. A. 4     
    2. B. 6        Correct Answer
    3. C. 2      
    4. D. Cannot be determined      
  5.  

    Of the three numbers, the average of the first and the second is greater than the average of the second and the third by 15. What is the difference between the first and the third of the three numbers
    1. A. 15       Correct Answer
    2. B. 45      
    3. C. 60      
    4. D. None of these      
  6.  

    The average of 25 results is 18, that of first 12 is 14 and of the last 12 is 17 Thirteenth result is
    1. A. 72     
    2. B. 78        Correct Answer
    3. C. 85      
    4. D. 28      
  7.  

    Average age of seven persons in a group is 30 years. The average age of five persons of this group is 31 years.  What is the average age of the other two persons in the group?
    1. A. 55 years       Correct Answer
    2. B. 26 years      
    3. C. 15 years      
    4. D. None of these      
  8.  

    Average weight of three boys P, T and R is 54(1/3) kg while the average weight of three boys T, F and G is 53 kg. What is the average weight of P, T, R, F and H
    1. A. 53.8 kg     
    2. B. 52.4 kg      
    3. C. 53.2 kg      
    4. D. Data inadequate         Correct Answer
  9.  

    In a class of 52 students the number of boys is two less than the number of girls. Average weight of the boys is 42 kg, while the average weight of all the 52 students is 40 kg. Approximately what is the average weight of the girls?
    1. A. 41 kg     
    2. B. 29 kg      
    3. C. 40 kg      
    4. D. 38 Kg        Correct Answer
  10.  

    While calculating the average of a batsman as 36 in 100 matches that he played, one of the score 90 was incorrectly noted as 40. The percentage error is
    1. A. 0.6%     
    2. B. 1.36%        Correct Answer
    3. C. 1.34%      
    4. D. 121%       
  11.  

    The average sale of a car dealership was 15 cars per week. After a promotional scheme, the average sale increased to 21 car per week. The percentage increase in the sale of Car was 
    1. A. 40%        Correct Answer
    2. B. 140%       
    3. C. 42(6/7)%      
    4. D. 39.33%      
  12.  

    In a class with a certain number of students, if one new student weighing 50 kg is added, then the average weight of the class increased by 1 kg. If one more student weighing 50 kg is added, then the average weight of the class increases by 1.5 kg over the original average. What is the original weight (in kg) of the class?
    1. A. 46      
    2. B. 42      
    3. C. 27      
    4. D. 47        Correct Answer
  13.  

    The average marks of a student in 8 subjects are 87. Of these, the highest marks are 2 more than the one next in value. If these two subjects are eliminated, the average mark of the remaining subjects is 85. What is the highest mark obtained by him?
    1. A. 94       Correct Answer
    2. B. 91      
    3. C. 89      
    4. D. 96      

MongoDB Find and FindOne Collection and Shell Method

Mongo Db Collection Method


We will perform all the mongoDB Shell collection methods on studentInfo DB. Create studentInfo Database in MongoDB server. Use the below code for creating the DB.

 

Using db.createCollection() method, create collection in database. Command to create studnet collection in studentInfo Database is below 


Insert Some Document in student collection where we can apply the MongoDB Collection Methods to explore further usage. I am Inserting five document in Student Collection.
Mongo Collection methods and example

Mongo Findone Shell Collection Method


Above Image contain the document in student collection. We will use student Collection from studentInfo DB to execute our Find One Mongo Methods. We will use pretty() function at the end of all the collection to get the output in parse format.

  • db.collectionName. find()
  • db.collectionName. findOne()
  • db.collectionName. findAndModify()
  • db.collectionName. findOneAndDelete()
  • db.collectionName. findOneAndReplace()
  • db.collectionName. findOneAndUpdate()

 db.student.find().pretty() :-
This above MongoDB Shell find Query will return all the document present in the Student Collection without filtering anything.

{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf54"),
        "id" : 1,
        "name" : "M Kumar",
        "dob" : "2003-04-07",
        "marks" : 54,
        "created_at" : "2017-11-13 23:33:42"
}
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf55"),
        "id" : 2,
        "name" : "MOHAMMED ISHAQ  H",
        "dob" : "2002-06-14",
        "marks" : 67,
        "created_at" : "2016-11-13 23:33:42"
}
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf56"),
        "id" : 3,
        "name" : "ANBUSELVAM S",
        "dob" : "2004-06-18",
        "marks" : 87,
        "created_at" : "2019-11-13 23:33:42"
}
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf57"),
        "id" : 4,
        "name" : "MARTINPRIYADOSS J",
        "dob" : "2004-03-08",
        "marks" : 43,
        "created_at" : "2012-11-13 23:33:42"
}
{
        "_id" : ObjectId("5ebf58376803d36568082c60"),
        "id" : 5,
        "name" : "JAGAN J",
        "dob" : "2003-04-10",
        "marks" : 98,
        "created_at" : "2012-11-13 23:33:42"
}

db.student.findOneAndDelete({name:"JAGAN J"})
This above query will find the document in which document.name will be equal to "JAGAN J" and it will delete that particular record and return the deleted document.
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf58"),
        "id" : 5,
        "name" : "JAGAN J",
        "dob" : "2003-04-10",
        "marks" : 98,
        "created_at" : "2012-11-13 23:33:42"
}

db.student.findOne()
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf54"),
        "id" : 1,
        "name" : "M Kumar",
        "dob" : "2003-04-07",
        "marks" : 54,
        "created_at" : "2017-11-13 23:33:42"
}
db.collectionName.findOne() method will return the first matching record from the document collection.

db.student.find({name:"M Kumar"}).forEach(printjson)
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf54"),
        "id" : 1,
        "name" : "M Kumar",
        "dob" : "2003-04-07",
        "marks" : 54,
        "created_at" : "2017-11-13 23:33:42"
}

db.student.find({name:"M Kumar"},{name:1,dob:1,marks:1}).pretty()
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf54"),
        "name" : "M Kumar",
        "dob" : "2003-04-07",
        "marks" : 54
}

Note :- Find() shell Collection Method will pull all the collection document fields. If you want some certain collection field then you have to pass the field-name : 1 as the second parameter. Example code is above for reference.

Logical Operator and Filter on FindOne Shell Method


db.student.findOne({marks :{$lt:50}},{name:1,dob:1})
{
        "_id" : ObjectId("5ebeaafd50845b5c0ea8bf57"),
        "name" : "MARTINPRIYADOSS J",
        "dob" : "2004-03-08"
}

db.collection.find({$or:[{marks :{$gt:70}},{name:"JAGAN J"}]}).pretty()
{
        "_id" : ObjectId("5ebea4f850845b5c0ea8bf51"),
        "id" : 3,
        "name" : "ANBUSELVAM S",
        "dob" : "2004-06-18",
        "marks" : 87,
        "created_at" : "2019-11-13 23:33:42"
}
{
        "_id" : ObjectId("5ebea4f850845b5c0ea8bf53"),
        "id" : 5,
        "name" : "JAGAN J",
        "dob" : "2003-04-10",
        "marks" : 98,
        "created_at" : "2012-11-13 23:33:42"
}

MongoDB Crud Operation and Mongo DB Crud

MongoDB Crud Operation

MongoDB Crud Operation Basics


Create studentInfo Database in MongoDB server. Use the below code for creating the DB.


Above use studentInfo command will create the DB in MongoDB Server. If studentInfo DB will exist then it will switch to that instead of creating it. To view the created database in the list you must have to create at least one collection in that.

MongoDB provide db.createCollection() method to create collection in database. Command to create studnet collection in studentInfo Database is below 


Press Enter collection will be created in studentInfo Database with the name of student. To view all the collection in the studentInfo Database use below command. Below command will list all the collection present in the studentInfo Database. 

Insert or Create Document in MongoDb Collection


To insert document in the collection in MongoDB Database. We use below two command to insert the document.

  • db.collectionName.insertOne()
  • db.collectionName.insertMany()

Using above two method we will insert the document in the student Collection of studentInfo Database. 

This below command will insert one document in student Collection.

db.student.insertOne(
   { 
     "id":1,
     "name":"Manoj Kumar",
     "dob":"2003-04-07",
     "marks":54,
     "created_at":"2017-11-13 23:33:42"
   }
)

To Insert many document at a time we have to use db.collectionName.insertMany() method . Below is the code for inserting many document at a time. We can pass all the document as a array.

db.student.insertMany([
   { 
     "id":2,
     "name":"MOHAMMED  H",
     "dob":"2002-06-14",
     "marks":67,
     "created_at":"2016-11-13 23:33:42"
   },
   { 
     "id":3,
     "name":"ANBUSELVAM S",
     "dob":"2004-06-18",
     "marks":87,
     "created_at":"2019-11-13 23:33:42"
   }
 ])



Fetch Or Retrieve Document from Collection


To retrieve or fetch the document from the MongoDB collection we use db.collectionName.find() method.
  • db.student.find() method will fetch all the document from the specified MongoDB collection. This above method will fetch all the document in single line which will not be in readable format.
  • db.student.find().pretty() method will fetch and arrange the collection document in some proper readable format. pretty() method will give you the output is below for reference. 

MongoDB Operators and Query Example


We can apply various filter on mongoDB collection document based on certain condition. We can use various operator also for document filter. Below is the query list and condition to demonstrate the filtration.

$eq (=)
$eq will match the value with specified value.
$gt (>)
$gt will check that the value is greater than specified value.
$gte (>=)
$gte will check that the value is greater than equal to specified Value.
$in (IN)
$in will check that specified value is there in range or not.
$nin (NOTIN)
$nin will check that specified value not lies in the range.
$lt (<)
$lt will check that the value is less than the specified value
$lte (=<)
$lte will check that the value is less than the specified value
$ne (!=)
$ne will check whether the value not equal to specified value


$and
Logical AND join multiple query clause and compare multiple clause and return value as True or False.
$not
Logical NOT Check the query expression and return the result.
$nor
Logical NOR join multiple query clause and compare multiple clause
$or
Logical OR  join multiple query clause and compare multiple clause and return value as True or False

Some Query Example using above operator is below for reference with output.

  •  db.student.find({marks:{$eq:43}}).pretty()     O/P is below                                                                                             
    mongoDB Comparision Operator Example

  • db.student.find({marks :{$gte:70}}).pretty()  O/P is below                                                                                 
    $gte operator in MongoDB

  • db.student.find({marks :{$in:[54, 87]}}).pretty()  O/P is below                                                                         

Query Using AND Logical Operator in MongoDB


  • db.student.find({$and :[{name : "JAGAN J"},{marks :98}]}).pretty()                                               {
            "_id" : ObjectId("5ebeaafd50845b5c0ea8bf58"),
            "id" : 5,
            "name" : "JAGAN J",
            "dob" : "2003-04-10",
            "marks" : 98,
            "created_at" : "2012-11-13 23:33:42"
        }


Query Using OR Logical Operator in MongoDB

  • db.student.find({$or :[{name:"JAGAN J"},{marks :{$gt:70}}]}).pretty()                                     {
            "_id" : ObjectId("5ebeaafd50845b5c0ea8bf56"),
            "id" : 3,
            "name" : "ANBUSELVAM S",
            "dob" : "2004-06-18",
            "marks" : 87,
            "created_at" : "2019-11-13 23:33:42"
    }
    {
            "_id" : ObjectId("5ebeaafd50845b5c0ea8bf58"),
            "id" : 5,
            "name" : "JAGAN J",
            "dob" : "2003-04-10",
            "marks" : 98,
            "created_at" : "2012-11-13 23:33:42"
    }

Query Using AND Operator as well as OR in MongoDB


  • db.student.find({marks :{$lt : 99}, $or :[{marks :{$in:[43,98]}},{name : "JAGAN J"}]}).pretty()                                                                                                                                  {
            "_id" : ObjectId("5ebeaafd50845b5c0ea8bf57"),
            "id" : 4,
            "name" : "MARTINPRIYADOSS J",
            "dob" : "2004-03-08",
            "marks" : 43,
            "created_at" : "2012-11-13 23:33:42"
    }
    {
            "_id" : ObjectId("5ebeaafd50845b5c0ea8bf58"),
            "id" : 5,
            "name" : "JAGAN J",
            "dob" : "2003-04-10",
            "marks" : 98,
            "created_at" : "2012-11-13 23:33:42"
    }

MongoDB Update Query

Update query in MongoDB is done using below method.
  • db.collection.updateOne() 
  • db.collection.updateMany() 
  • db.collection.replaceOne()

Delete Operation In MongoDB

Delete Query in MongoDB is done using below method.
  • db.collection.deleteOne() 
  • db.collection.deleteMany() 

AWS Elastic Load Balancer and ELB and ALB Pricing

AWS ELB and Amazon Elastic Load Balanacer
AWS Load balancer accept all the incoming Application incoming Traffic and distribute to multiple target such as EC2 instance, container etc.. Elastic Load Balancer support various type of Load Balancer.

1) Application Load Balancers
2) Network Load Balancers
3) Classic Load Balancers

   Load Balencer ensure that server resource must be available 24 x 7 without any fault. Amazon ELB ensures fall tolerance and High Availability of server resource. Web Traffic get distributed to the available backend server using AWS ELB. 
    Load Balancer contain mainly three part :- Listner (Which will listen Port), Traget Group and third is Traget.



Load Balancer distribute the traffic request to various server to balance the load more or less equally.
Whatever ( http / https ) request comes to the load balancer based on the server traffic and health status it will divert.



Amazon S3 Bucket Pricing and AWS Bucket Storage


Amazon S3 Bucket
AWS Storage Type

  • S3 (Simple Storage Services) [Object Level Based Storage]
  • EFS (Elastic File System)
  • EBS (Elastic Block Storage)
  • Glacier 
  • Snowball

Amazon S3(Simple Storage Services)

  • Amazon S3 is public storage resource in AWS (Amazon Web Services) Cloud which is object based storage.
  • AWS S3 Bucket is storage same like a file folders which store objects with data and its Metadata.
  • S3 stores all the files (like pdf, images, video, documents etc ) as a object in AWS Cloud. You cannot have the Bucket inside bucket, Bucket can have the folders which groups object inside in it. S3 bucket is having flat architecture (Bucket inside bucket you can't create.).
  • If you want to use AWS S3 services, First you have to create the S3 Bucket in any of the AWS Region. Bucket name is unique Globally. Once Bucket is created it get shared with all the AWS Account. The bucket name cannot be used by any other AWS account.
  • Amazon S3 services comes under IaaS (Infrastructure as a Services). The Important AWS Services which is offered as Iaas is S3 (Simple Storage Service), EC2 (Elastic computing 2)  and RDS (Relational Database Service). These IaaS services is charged per hour basis.
  • We can't Install operating System in S3 Storage.
  • AWS S3 have distributed Data Architecture where copy of data is stored in multiple location within the region.
  • Bucket can store maximum 5TB Data, 100 bucket per aws Account which you can extend further.  
  • S3 Bucket cannot be transferred from one aws account to another AWS account. It can be shared and can be access with multiple location.

S3 Bucket and Naming Rules

  • Bucket name is Globally Unique. In AWS Cloud two bucket can't have the same name. It must be unique.
  • Once the Bucket name is created it cannot be changed. If bucket name is deleted then again it will be available for other user to choose that Bucket name.
  • Bucket name must contain atleaste 3 Character and max 63 Character.
  • Bucket Name is URL part through which we try to access the bucket.
  • Bucket name can be created using lower Case letter, number and hyphen. We cant use Upper case letter while naming the bucket. You cant start and end the bucket name with -(hyphen). Bucket name should not be an IP address.
  • Whenever we create bucket or Object, By default it is private. Only bucket owner can access that.    

S3 Bucket Sub-resources

  • Object Life cycle : In this we can define the object life cycle. We can move the object based on the time frame from one storage type to other storage. this can reduce the cost. See the below image where we are moving the object from one storage to other based on the recent data. 
  • Website : We can use S3 for hosting Static website.
  • Versioning : You can enable the versioning on your storage which will maintain your previous updated file and the current file too. You cant disable the versioning. You can enable or suspend the versioning.
  • Access Control List : In this you can decide the security of your bucket regarding access.

S3 Bucket Versioning

Bucket Versioning help us to recover the data in the case of accidental delete. Suppose you deleted the Data accidentally, to retrieve the data we enable versioning. Versioning maintain the older data as well as the current data. If the versioning is enabled and the object / Data got deleted, in that case you can recover / restore the data easily.

Versioning Help us in data retention as well as data archive. Once you enable the Versioning, you can't disable it. You can suspend it only.

When Versioning is enabled and we delete the object / data , delete marker is placed on the object which we can recover whenever we want.

You will be charged for all the multiple versions. Example Just imagine you have 10 MB file initially, next versioning your file size became 14 MB, again in next versioning it became 18 MB. It will be charged for incremental only which will be 8 MB not for 42 MB. This is incremental versioning.   

You can apply the life-cycle on versioning which means as the object / data become older we can move it to cheaper storage or we can delete the data.

The Object which exist before version enabling will have the version ID Null. 

Multi Factor Authentication (MFA)

MFA is extra level of security which we can apply on our S3 Bucket. By Enabling the Multi-factor authentication you restrict the other users to delete the S3 object accidentally. Once the Multi-factor Authentication is enabled you can delete until unless the security code received by the registered physical device is shared with you within 30 second.  

S3 Multipart Upload

S3 Multipart Upload allow us to upload our file to server in parts. This object parts get uploaded independently and in parallel. You must use the multipart Upload facility to upload the file in the server if the size is equal or greater than 5 gb using Multipart Upload API.

Type of AWS S3 Storage  

1) Amazon S3 Standard [Storage Cost is High but Accessing / Retrieving cost is low. ]
    This Storage is useful if you need data access frequently. 

2) Amazon S3 Glacier Deep Archive  [Storage Cost is cheapest but Retrieving cost is High.]
    Amazon S3 Glacier Deep Archive is suitable when you have rare access to the data(Once in a year or rare access.). As S3 Glacier Deep Archive storage is damm Cheaper but accessing the data cost higher. Accessing Glacier Deep Archive Data takes time which is not fix. 

3) Amazon Glacier
Amazon S3 Glacier is little costlier then Glacier Deep Archive. This also we use when we don't need the data access frequently. Accessing Glacier Data takes time which is not fix. The Main difference between Amazon glacier and Glacier Deep Archive is, in AWS Glacier you have the option to select the data retrieval time. This means you can select the access time if you want to access the data. Three Option Available for data retrieval, you want retrieval within a minute, within a Hour, or within 12 hour.     

4) Amazon S3 Standard Infrequent Access 
Amazon S3 Standard Infrequent Access This storage is best for infrequent access. Sometime you need to access the data and you need it immediately. This storage provide immediate access it don't delay like Amazon Glacier or Amazon S3 Glacier Deep Archive. Overall it is infrequent access of data but whenever it is access data must available immediately without delay.

5) Amazon S3 One Zone - IA
By Default S3 Create three copy of your data and keep it as a back up and charge you accordingly. And in any disaster it will recover your data using other copy. S3 One Zone  allow you to keep only one copy of the data in one zone. In disaster your data is not recoverable. 

6) Amazon S3 Intelligent tearing. 
We use this Intelligent Tearing storage in case of when we dont know whether we are going to access the data immediately or not.

Our Feature Post

There is a tree between houses of A and B If the tree leans on As House

    There is a tree between houses of A and B. If the tree There is a tree between houses of A and B. If the tree leans on A’s House, the t...

Our Popular Post