Strings & Functions interview questions

21 Strings & Functions questions from the PHP bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

1. What is String interpolation?

Junior
  1. A.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  2. B.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  3. C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely

Answer + AI explanation with Pro

2. Which term means: "the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output"?

Junior
  1. A.String interpolation
  2. B.Variadic parameter
  3. C.Named arguments
  4. D.Heredoc

Answer + AI explanation with Pro

3. Which statement is correct?

Junior
  1. A.String interpolation — the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  2. B.String interpolation — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
  3. C.String interpolation — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  4. D.String interpolation — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function

Answer + AI explanation with Pro

4. What is Heredoc?

Junior
  1. A.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  2. B.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  3. C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function

Answer + AI explanation with Pro

5. Which term means: "a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string"?

Junior
  1. A.Heredoc
  2. B.Nowdoc
  3. C.Named arguments
  4. D.First-class callable syntax

Answer + AI explanation with Pro

6. Which statement is correct?

Junior
  1. A.Heredoc — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  2. B.Heredoc — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
  3. C.Heredoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  4. D.Heredoc — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string

Answer + AI explanation with Pro

7. What is Nowdoc?

Mid
  1. A.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  2. B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  3. C.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  4. D.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing

Answer + AI explanation with Pro

8. Which term means: "a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing"?

Mid
  1. A.First-class callable syntax
  2. B.Variadic parameter
  3. C.Arrow function
  4. D.Nowdoc

Answer + AI explanation with Pro

9. Which statement is correct?

Mid
  1. A.Nowdoc — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  2. B.Nowdoc — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  3. C.Nowdoc — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.Nowdoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function

Answer + AI explanation with Pro

10. What is Variadic parameter?

Mid
  1. A.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  2. B.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function

Answer + AI explanation with Pro

11. Which term means: "a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function"?

Mid
  1. A.String interpolation
  2. B.Named arguments
  3. C.Variadic parameter
  4. D.Arrow function

Answer + AI explanation with Pro

12. Which statement is correct?

Mid
  1. A.Variadic parameter — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  2. B.Variadic parameter — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  3. C.Variadic parameter — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  4. D.Variadic parameter — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value

Answer + AI explanation with Pro

13. What is Named arguments?

Mid
  1. A.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  2. B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely

Answer + AI explanation with Pro

14. Which term means: "passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely"?

Mid
  1. A.Variadic parameter
  2. B.Arrow function
  3. C.Named arguments
  4. D.String interpolation

Answer + AI explanation with Pro

15. Which statement is correct?

Mid
  1. A.Named arguments — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  2. B.Named arguments — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  3. C.Named arguments — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
  4. D.Named arguments — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing

Answer + AI explanation with Pro

16. What is Arrow function?

Mid
  1. A.the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
  2. B.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  3. C.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
  4. D.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value

Answer + AI explanation with Pro

17. Which term means: "a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value"?

Mid
  1. A.Arrow function
  2. B.Named arguments
  3. C.First-class callable syntax
  4. D.String interpolation

Answer + AI explanation with Pro

18. Which statement is correct?

Mid
  1. A.Arrow function — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  2. B.Arrow function — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  3. C.Arrow function — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  4. D.Arrow function — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string

Answer + AI explanation with Pro

19. What is First-class callable syntax?

Senior
  1. A.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  2. B.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. D.the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method

Answer + AI explanation with Pro

20. Which term means: "the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method"?

Senior
  1. A.Named arguments
  2. B.Heredoc
  3. C.Nowdoc
  4. D.First-class callable syntax

Answer + AI explanation with Pro

21. Which statement is correct?

Senior
  1. A.First-class callable syntax — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
  2. B.First-class callable syntax — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  3. C.First-class callable syntax — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
  4. D.First-class callable syntax — the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Strings & Functions question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers