Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Go Test Assessment

Topics Covered

  • Error Handling
  • Interfaces
  • Goroutines
  • Arrays and Slices
  • Functions
  • Pointers
  • Structures
  • Interfaces
  • Time Package

Useful for hiring

  • System Software Engineer - Golang
  • Golang Developer

Start hiring job-fit candidates using this assessment

GET A DEMO

"We are impressed by the caliber, depth, and breadth of the assessments provided by Interview Mocha. With Interview Mocha's online proctoring & powerful reports, we are able to hire quality candidates overcoming geographical barriers."

Megan Akhras, J'Excelle,Canada,
Co-founder & director
Question

Choose correct ways to count time consumed by HTTP request.

Note: There can be multiple correct answers to this question.

Answer
    • start := time.Now()
      resp, err := http.Get("https://fb.com")
      elapsed := time.Now() - start
      fmt.Println(elapsed)

    • start := time.Now()
      resp, err := http.Get("https://fb.com")
      elapsed := time.Since(start).Seconds()
      fmt.Println(elapsed)

    • start := time.Now()
      resp, err := http.Get("https://fb.com")
      elapsed := time.Now().After(start)
      fmt.Println(elapsed)

    • start := time.Now()
      resp, err := http.Get("https://fb.com")
      elapsed := time.Now().Sub(start)
      fmt.Println(elapsed)

Question

Which of the following ways is correct to define custom function for "int" type?

Note: There can be multiple correct answers to this question.

Answer
    • func (i int) Custom(){
          //...
      }

    • func (i *int) Custom(){
          //...
      }

    • type MyInt int

      func (i MyInt) Custom(){
          //...
      }

    • type MyInt struct{
          int
      }

      func (i MyInt) Custom() {
          //...
      }

Question

Having a simple HTTP server started with:

    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
Create a proper "handler" function to serve "/" address with HTML code.

  My Title
  Test exercise
    

Answer
    • func handler() *io.Writer {
          res := new(io.Writer)
          res.Write([]byte(`
              <html>
              <head><title>My Title</title></head>
              <body>Test exercise</body>
              </html>
          `))
      }

    • func handler() []byte {
          return []byte("<html>" +
          "<head><title>My Title</title></head>" +
          "<body>Test exercise</body>" +
          "</html>")
      }

    • func handler(res http.ResponseWriter, req *http.Request) {
          res.Write([]byte(`
              <html>
              <head><title>My Title</title></head>
              <body>Test exercise</body>
              </html>
          `))
      }

    • func handler(res http.ResponseWriter, req *http.Request) {
          req.Write([]byte("<html>" +
          "<head><title>My Title</title></head>" +
          "<body>Test exercise</body>" +
          "</html>"))
      }

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO