All India Exams
Home AptitudeBankEngineeringEnglishGKInterviewOnline TestPlacement PapersReasoning
  • Home
  • Aptitude
  • Bank
  • Engineering
  • English
  • GK
  • Interview
  • Online Test
  • Placement Papers
  • Reasoning

Arrays Questions And Answers

Here you can find Arrays Questions and Answers.

Why Arrays Questions and Answers Required?

In this Arrays Questions and Answers section you can learn and practice Arrays Questions and Answers to improve your skills in order to face technical inerview conducted by organisations. By Practicing these interview questions, you can easily crack any Exams interview.

Where can I get Arrays Questions and Answers?

AllIndiaExams provides you lots Arrays Questions and Answers with proper explanation. Fully solved examples with detailed answer description. All students, freshers can download Arrays Questions and Answers as PDF files and eBooks.

How to solve these Arrays Questions and Answers?

You no need to worry, we have given lots of Arrays Questions and Answers and also we have provided lots of FAQ's to quickly answer the questions in the Competitive Exams interview.

Arrays Questions & Answers

1. PHP’s numerically indexed array begin with position __.

Arrays Questions & Answers

2. Which of the functions is used to sort an array in descending order?

Arrays Questions & Answers

3. Which of the following are correct ways of creating an array? (i) state[0] = “karnataka”; (ii) $state[] = array(“karnataka”); (iii) $state[0] = “karnataka”; (iv) $state = array(“karnataka”);

Arrays Questions & Answers

4. What will be the output of the following PHP code? < ?php $fruits = array ("mango", "apple", "pear", "peach"); $fruits = array_flip($fruits); echo ($fruits[0]); ?>

Arrays Questions & Answers

What will be the output of the following php code? < ?php $states = array("karnataka" => array ( "population" => "11,35,000", "captial" => "Bangalore"), "Tamil Nadu" => array( "population" => "17,90,000", "captial" => "Chennai") ); echo $states["karnataka"]["population"]; ?>

Arrays Questions & Answers

6. Which function will return true if a variable is an array or false if it is not?

Arrays Questions & Answers

7. Which in-built function will add a value to the end of an array?

Arrays Questions & Answers

8. What will be the output of the following PHP code? < ?php $state = array ("Karnataka", "Goa", "Tamil Nadu", "Andhra Pradesh"); echo (array_search ("Tamil Nadu", $state) ); ?>

Arrays Questions & Answers

9. What will be the output of the following PHP code? < ?php $fruits = array ("apple", "orange", "banana"); echo (next($fruits)); echo (next($fruits)); ?>

Arrays Questions & Answers

10. Which function can be used to move the pointer to the previous array position?

Home EngineeringComputer Science & EngineeringPHP Questions and AnswersArrays

Arrays - PHP Questions and Answers

This is the questions and answers section on "PHP Arrays" with explanation for various interview, competitive examination and entrance test. Solved examples with detailed answer description, explanation are given and it would be easy to understand.

PHP Arrays Questions - Quiz Details

Online Test Name Arrays
Exam Type Multiple Choice Questions
Category Computer Science Engineering Quiz
Number of Questions 16
1. PHP's numerically indexed array begin with position __.
  • A. 1
  • B. 2
  • C. 0
  • D. -1
  • View Answer
  • Workspace
  • Report
  • Discuss

Answer & Explanation

Answer: Option C

Explanation:

Like many programming languages, the first element of an array has an index value of 0.

Workspace

Report Error


2. Which of the functions is used to sort an array in descending order?
  • A. sort()
  • B. asort()
  • C. rsort()
  • D. dsort()
  • View Answer
  • Workspace
  • Report
  • Discuss

Answer & Explanation

Answer: Option C

Explanation:

sort() function is used to sort in ascending order where as rsort() meaning reverse sort is used for sorting in descending order.

Workspace

Report Error


3. Which of the following are correct ways of creating an array?
(i) state[0] = "karnataka;
(ii) $state[] = array("karnataka);
(iii) $state[0] = "karnataka;
(iv) $state = array("karnataka);
  • A. (iii) and (iv)
  • B. (ii) and (iii)
  • C. Only (i)
  • D. (ii), (iii) and (iv)
  • View Answer
  • Workspace
  • Report
  • Discuss

Answer & Explanation

Answer: Option A

Explanation:

A variable name should start with $ symbol which is not present in i) and you need not put the square brackets when you use the array() constructor.

Workspace

Report Error


4. What will be the output of the following PHP code?
< ?php 
    $fruits = array ("mango", "apple", "pear", "peach");
    $fruits = array_flip($fruits);
    echo ($fruits[0]);
?>
  • A. mango
  • B. Error
  • C. peach
  • D. 0
  • View Answer
  • Workspace
  • Report
  • Discuss

Answer & Explanation

Answer: Option B

Explanation:

As we are flipping the values, $fruits["mango"] = 0, $fruits["apple"] = 1 and so on.

Workspace

Report Error


5. What will be the output of the following php code?
< ?php 
    $states = array("karnataka" => array
    ( "population" => "11,35,000", "captial" => "Bangalore"),
    "Tamil Nadu" => array( "population" => "17,90,000",
    "captial" => "Chennai") );
    echo  $states["karnataka"]["population"];
?>
  • A. karnataka 11,35,000
  • B. 11,35,000
  • C. population 11,35,000
  • D. karnataka population
  • View Answer
  • Workspace
  • Report
  • Discuss

Answer & Explanation

Answer: Option B

Explanation:

Treat states as a multidimensional array and accordingly traverse it to get the value.

Workspace

Report Error


  • «
  • 1
  • 2
  • 3
  • 4
  • »

Related Topics:

  • MySQL Basics
  • HTML Forms
  • PHP Basics
  • Object Oriented PHP
  • Functions
  • Strings & Regular Expressions
  • Exception Handling
  • Variables

Mock Tests & Online Quizzes

  • Aptitude Online Test

  • Reasoning Online Test

  • GK Online Test

  • English Online Test

  • RRB Mock Test

  • RBI Mock Test

  • Free SBI Mock Test

  • IBPS Mock Test FREE

  • SSC Mock Test

  • CAT Exam Mock Test

  • GATE Mock Test

  • IT Courses Quiz

Questions and Answers

  • Aptitude Questions
  • Verbal Reasoning Questions
  • Non Verbal Reasoning
  • Logical Reasoning Questions
  • Data Sufficiency Questions
  • Data Interpretation
  • eLitmus Sample Papers
  • ECE Questions and Answers
  • EEE Questions and Answers
  • Verbal Ability Questions
  • GK Questions

Programming Quiz

  • C Programming
  • C++ Programming
  • PHP Programming
  • Java Programming
  • Python Programming
  • DataScience MCQ
  • Hadoop MCQ
  • Mongo DB MCQ
  • MySQL MCQ

Interview Questions

  • Java Interview Questions
  • .Net Interview Questions
  • Networking Interview Questions
  • C Language Interview Questions
  • C++ Interview Questions
  • Testing Interview Questions
  • Android Interview Questions
  • HR Interview Questions
  • Group Discussion Topics

Our Sites

AView.in

© by AllIndiaExams.in. All Rights Reserved | Copyright | Terms of Use & Privacy Policy