HomeExamsCodeINFYASSESSMENT
INFYASSESSMENT

Go Programming Language - Assessment

Practice with real exam-pattern questions for Go Programming Language - Assessment. Each question includes a detailed explanation to help you understand the concept, not just memorise the answer. Try 10 questions free — no login required.

BeginnerCode90 min
Free questions

10 Go Programming Language - Assessment practice questions with answers

Real Lex exam-pattern multiple-choice questions for the Go Programming Language - Assessment certification. Each question includes the correct answer. The full question bank is available to Premium members.

  1. Question 1

    For the given struct, which of the following are incorrect initialization of struct instances (Select only two options)?

    type Car struct{
        model string
        brand string
        yearOfProd int
        isInsured bool
        status string
    } 

    • carOne := Car{"Nissan", "Silvia S15", 1996, true, "Salvage Title"}

      Correct
    • B

      carTwo := Car{model:"Silvia S15", brand:"Nissan", isInsured:"true", yearOfProd:1996}

    • C

      carThree := Car{model:"Silvia S15", brand:"Nissan", yearOfProd:1996}

    • D

      carFour := Car{"Nissan", "Silvia S15", 1996, "Salvage Title", true}

  2. Question 2

    What will be the output in the following code snippet?

    package main
    
    import "fmt"
    
    func compareString[T any](function func(T, T) T, slice []T) T {
    	result := slice[0]
    	for index := 1; index < len(slice); index++ {
    		result = function(result, slice[index])
    	}
    	return result
    }
    
    func main() {
    	stringSlice := []string{"Famous Five", "Hardy Boys", "Nancy Drew"}
    	modifyFunc := func(value1, value2 string) string {
    		if len(value2) > len(value1) {
    			return value2
    		} else {
    			return value1
    		}
    	}
    	result := compareString(modifyFunc, stringSlice)
    	fmt.Println(result)
    }

    • Famous Five

      Correct
    • B

      Nancy Drew

    • C

      Hardy Boys

    • D

      Compilation Error

  3. Question 3

    Consider the slice list given below.

    Identify the Go code to be written at Line 1 such that the output is [ java programming ]

    package main
    import(
        "fmt"
    )
    
    func main(){
        myCourses := []string{"python","java","go","programming"}
        newSlice:=myCourses[3:]      
         
        #Line1_______________________________ 
        fmt.Println(slice1)
    }
    

    • slice1:= myCourses[1:2] + newSlice

      Correct
    • B

      slice1:= myCourses[1:2] + newSlice

    • C

      slice1:= append(myCourses[1:2], newSlice...)

    • D

      slice1:= myCourses[:2] + newSlice

  4. Question 4

    What’s the output of the following code?

    package main
    import "fmt"
    func main() {
    	var flagA int8 = 3
    	var flagB int16 = 4
    	sum := flagA + flagB
    	fmt.Println(sum)
    }

    • 7

      Correct
    • B

      Compilation Error due to mismatched types

    • C

      4

    • D

      3

  5. Question 5

    What’s the output of the following code?

    package main
    import "fmt"
    const (
        varA = iota
        varB = iota
        varC = iota
    )
    
    const (
        varD, varE, varF = iota, iota, iota
    )
    
    func main() {
        fmt.Println(varA, varB, varC, varD, varE, varF)
    }
    

    • 0 0 0 0 1 2

      Correct
    • B

      0 1 2 0 1 2

    • C

      0 1 2 0 0 0

    • D

      0 1 2 3 4 5

  6. Question 6

    What is the output of the following code snippet?

    func main() {
      sliceX := [...]int {1, 2, 3, 4, 5}
      sliceY := sliceX[0:2]
      sliceZ := sliceX[1:4]
      fmt.Print(len(sliceY), cap(sliceY), len(sliceZ), cap(sliceZ))
    }
    

    • 2 5 3 4

      Correct
    • B

      2 5 3 3

    • C

      2 5 3 5

    • D

      2 4 3 4

  7. Question 7

    Predict the output of the following code snippet.

    package main
    
    import (
    	"fmt"
    )
    
    func sport() {
    	fmt.Printf("In sport function->")
    }
    func getSport(arr []string, ind int) string {
    	sport()
    	if len(arr) > ind {
    		return arr[ind]
    	} else {
    		panic("Index out of bound")
    	}
    }
    func defFunc() {
    	fmt.Printf("Deferred Function called->")
    	re := recover()
    	if re != nil {
    		fmt.Printf(" Error from Recovery : %v", re)
    	}
    }
    func main() {
    	defer defFunc()
    	sportArr := []string{"Cricket", "Hockey", "Football"}
    	getSport(sportArr, 3)
    }

    • Compilation error

      Correct
    • B

      Runtime error

    • C

      Deferred Function called-> In sport function -> Error from Recovery : Index out of bound

    • D

      In sport function->Deferred Function called-> Error from Recovery : Index out of bound

  8. Question 8

    Which of the following options will be the correct function declaration (at Line1) for the given code snippet and sample output?

    Code Snippet:

    type car struct {
        name string
        brand string
    }
    
    __________//Line1__________ {         
        newCar.name = "Civic"
        newCar.brand = "Honda"
    }
    
    func main() {
        setCar := car{                  
          name:    "Celica",
          brand: "Toyota",
        }
        setCar.carSwap()                   
    
        fmt.Printf("Your current car is: %v %v", setCar.brand, setCar.name)
    }
    

    Sample Output:

    Your current car is: Toyota Celica

    • func (newCar car) carSwap()

      Correct
    • B

      func carSwap(newCar *car)

    • C

      func (newCar *car) carSwap()

    • D

      func carSwap(newCar car)

  9. Question 9

    Which of the following statement is/are true?

    1. The length and capacity for an array are always equal.
    2. The length and capacity for a slice are always equal.

    • Statement (1) and (2) are both true.

      Correct
    • B

      Statement (1) is true and (2) is false.

    • C

      Statement (1) is false and (2) is true.

    • D

      Statement (1) and (2) are both false.

  10. Question 10

    What will be the new content of the slice “carModelSlice” after the following operations:

    carModelSlice:=[]string{"AE86_Trueno","FC_RX7","Supra","Levin_AE85","Skyline","Chaser_JZX100","Silvia_S15"}
    	
    carModelSlice = append(carModelSlice[:3], carModelSlice[4:]...)
    carModelSlice = carModelSlice[2:6]

    • [Supra Skyline Chaser_JZX100 Levin_AE85 Silvia_S15]

      Correct
    • B

      [Supra Skyline Chaser_JZX100 Silvia_S15]

    • C

      [Supra Chaser_JZX100 Silvia_S15]

    • D

      [Supra Skyline Chaser_JZX100]

Pricing

Pay once. Clear every cert this year.

One subscription, full Telegram channel access, every PDF posted during your membership.

Monthly
50% OFF
₹1,300₹2,600
Per month · cancel anytime
  • Full access to all 1,357+ certifications
  • Monthly updated question banks
  • Telegram private channel access
  • Cancel anytime
Get Monthly
POPULAR
Quarterly
44% OFF
₹1,800₹3,200
That's ₹600/mo · billed for 3 months
  • Everything in Monthly
  • Save ₹2,100 vs monthly billing
  • Priority answer key requests
  • Best for increasing DQ score fast
Get Quarterly
BEST VALUE
Lifetime
52% OFF
₹2,400₹5,000
One-time · lifetime access
  • Everything in Quarterly
  • Lifetime channel access — no renewals
  • All future certifications included
  • Priority response from admin team
Get Lifetime
FAQ

Common questions, straight answers.

A monthly-updated Telegram channel where we post real exam-pattern question banks and detailed answer keys for 1,357+ Infosys Lex certifications. You join once, you get every PDF posted during your membership.

Right after payment on our Graphy page, you'll receive a private invite link to the Telegram channel. Access is instant — usually under 30 seconds.

We compile question banks from the actual Lex test pattern, sourced and verified by 180K+ community members who've recently cleared these exams. Match rate is consistently 85–95%.

Every single month. When Infosys rolls out new versions of certifications, we post updated dumps within 7–10 days. You'll see channel activity weekly.

Clearing certifications is one of the highest-weighted DQ factors. Members typically clear 3–5 certifications in their first 3 months, which moves DQ scores up by a full band.

i
InfyLexDumps

Independent exam preparation platform for Infosys Lex certifications. Real exam-pattern question banks, monthly updates, 180K+ community members.

Join Premium Telegram
Contact
  • @prepflixadmin
  • admin@prepflix.net
This platform is an independent educational resource and is not affiliated with or endorsed by Infosys Ltd. All certification names referenced are property of their respective owners.
© 2026 InfyLexDumps
Join Premium Telegram