Most Asked SonarQube Questions for Freshers (2027)

40 most asked SonarQube interview questions for freshers: quality gates, profiles, new code, scanners, tokens, severities and CI basics.

Sep 26, 2025 - 10:57
Nov 9, 2026 - 02:03
 0  73
Most Asked SonarQube Questions for Freshers (2027)

The SonarQube questions freshers get asked most are about basics: what SonarQube does, how a scan reaches the server, what quality gates and quality profiles are, what "new code" means, and how issues are classified. Panels want plain, accurate definitions plus one example of running an analysis from a CI pipeline.

This page has 40 beginner-level questions with short answers, checked against Sonar's documentation for SonarQube Server 2026.5 in November 2026. It is written for freshers and career changers. If you already use SonarQube at work, the 90+ SonarQube interview questions bank goes deeper, and the scenario-based SonarQube questions cover team rollout problems.

Key takeaways

  • Sonar sells and documents several products: SonarQube Server (self-managed, Developer, Enterprise and Data Center editions), SonarQube Cloud (SaaS), the free SonarQube Community Build, and the SonarQube for IDE extension.
  • A scanner runs in your build, sends a report to the server, and the server's Compute Engine processes it.
  • The built-in "Sonar way" quality gate checks new code: no new issues, all new Security Hotspots reviewed, coverage of at least 80% and duplication of at most 3%.
  • Issues affect three software qualities (security, reliability, maintainability) with severities from Blocker to Info.
  • Sonar's 2026.5 documentation says Security Hotspots are being phased out and converted to vulnerabilities or security issues. Mention it if asked about hotspots.

SonarQube terms freshers should know

TermMeaning in one line
ScannerTool that analyses code in the build and uploads a report
Compute EngineServer process that turns reports into stored results
Quality profileThe set of rules used for one language
Quality gatePass or fail conditions applied to the analysis result
New codeCode changed within the project's new code definition
IssueA place where code breaks a rule
Technical debtEstimated effort to fix maintainability issues
TokenCredential the scanner uses to authenticate

Freshers: basics and definitions (1-18)

1. What is SonarQube?

SonarQube is a code quality and code security tool from SonarSource. It runs static analysis on source code, reports issues such as bugs, vulnerabilities and maintainability problems, tracks coverage and duplication, and can fail a pipeline through a quality gate when new code does not meet the standard.

2. What is static code analysis?

Static analysis inspects source code without running it. It looks for patterns that break rules, such as possible null dereferences, SQL built from user input or overly complex functions. It complements unit tests, which check behaviour by running code.

3. Which SonarQube products exist, and how do they differ?

SonarQube Server is self-managed and comes in Developer, Enterprise and Data Center editions. SonarQube Cloud is the SaaS version. SonarQube Community Build is the free, self-managed option, which Sonar describes as supporting 40+ languages. SonarQube for IDE is a free editor extension that shows issues while you type and can connect to Server or Cloud.

4. What was SonarLint?

SonarLint was the earlier name of the IDE extension now documented as SonarQube for IDE. You may hear both names in interviews. Its connected mode syncs rules and issue status with your SonarQube Server or Cloud project.

5. What are the main parts of a SonarQube Server installation?

Sonar's documentation describes three Java processes: the Web server (UI and API), the Compute Engine (processes analysis reports and stores results) and an embedded Elasticsearch (search index). A separate database holds the data. Scanners run outside the server, in your build.

6. Which databases does SonarQube Server support?

The 2026.5 installation docs list PostgreSQL, Microsoft SQL Server and Oracle for production. An embedded H2 database exists only for trials and testing, and Sonar says to limit H2 to that use.

7. What port does SonarQube use by default?

The web interface listens on port 9000 by default. Sonar's try-out guide runs the Docker image with -p 9000:9000 and logs in at http://localhost:9000.

docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest

The environment variable in that command skips Elasticsearch bootstrap checks and is meant for a quick local trial, not production.

8. What is a scanner?

A scanner is the client that analyses code and sends results to the server. Sonar provides SonarScanner CLI plus scanners for Maven, Gradle, .NET and npm, and integrations for CI platforms. Build-tool scanners read project details from the build, so they need less configuration.

9. What is a project key?

sonar.projectKey is the unique identifier of a project on the server. Sonar's parameter reference says it is mandatory and can include up to 400 characters: letters, digits, dash, underscore, period and colon.

10. How does a scanner authenticate?

With a token passed as sonar.token (or the SONAR_TOKEN environment variable). Tokens can be scoped to a project or be global. In CI, store the token as a secret variable, never in the repository.

11. What is a quality profile?

A quality profile is the list of rules activated for one language. Each language has a built-in profile called "Sonar way", which is a sensible starting point. Teams can copy it, add or remove rules, and assign the custom profile to projects.

12. What is a quality gate?

A quality gate is a set of conditions that an analysis must meet. If any condition fails, the gate fails. Teams use it to block merges or deployments when new code does not meet the standard.

13. What does the default "Sonar way" quality gate check?

Sonar's documentation lists four conditions on new code: no new issues are introduced, all new Security Hotspots are reviewed, new code coverage is at least 80.0%, and duplication in new code is at most 3.0%. The built-in gate is read-only; copy it if you need different values.

14. Quality profile vs quality gate: what is the difference?

The profile decides which rules raise issues. The gate decides whether the result is acceptable. Changing the profile changes what is found; changing the gate changes what blocks a release.

15. What is "new code" in SonarQube?

New code is the code added or changed within the project's new code definition. The documented options are Previous version, Number of days, Reference branch and Specific analysis (the last one only through the Web API). Focusing the gate on new code lets teams improve quality without fixing years of old issues first.

16. What are the three software qualities?

Security, reliability and maintainability. Sonar defines reliability as the ability to keep performing under stated conditions and maintainability as how easily code can be repaired, improved and understood. Each rule affects one or more of these qualities.

17. What severities can an issue have?

In current SonarQube Server, each affected software quality gets a severity of Blocker, High, Medium, Low or Info. Blocker means a high chance of severe consequences such as production crashes or serious security flaws, and should be fixed immediately. Info has no expected impact.

18. What are Standard Experience and MQR mode?

They are two ways the instance can present issues. Standard Experience uses the older types: bug, vulnerability and code smell. MQR (Multi-Quality Rule) mode shows the impact of each issue on all software qualities with the severities above. Ask which mode a team uses before comparing numbers.

Freshers: running an analysis (19-30)

19. How do you run a basic analysis with SonarScanner CLI?

Create a token in the UI, then run the scanner from the project root with the server URL, project key and token. A sonar-project.properties file can hold the fixed settings.

# sonar-project.properties
sonar.projectKey=shop-api
sonar.sources=src
sonar.tests=tests
export SONAR_TOKEN=***   # from your CI secret store
sonar-scanner -Dsonar.host.url=http://localhost:9000

20. What does sonar.sources do?

It sets the initial scope of main (non-test) source code to analyse. Build-tool scanners such as Maven and Gradle usually work this out from the build, so you set it mainly with the CLI scanner.

21. How do you exclude files from analysis?

Use sonar.exclusions for files that should not be analysed at all (generated code, vendored libraries). Use sonar.coverage.exclusions to keep files out of coverage only, and sonar.cpd.exclusions to keep them out of duplication detection.

22. Where can analysis parameters be set, and which wins?

Sonar documents this order from highest to lowest priority: scanner arguments on the command line, scanner configuration files, project settings in the UI, then global settings in the UI. Some values, such as the token and server URL, cannot be set in the UI.

23. How do you make the pipeline wait for the quality gate?

Set sonar.qualitygate.wait=true. The scanner then polls the server and fails the step if the gate fails. sonar.qualitygate.timeout sets how many seconds to wait for the report to be processed; the documented default is 300.

24. Why is test coverage shown as 0% after a scan?

SonarQube does not run tests. It imports coverage reports produced by your test tool (for example JaCoCo for Java or an LCOV file for JavaScript). If the report is missing, in the wrong path or not configured with the right property, coverage stays at zero.

25. What is code duplication in SonarQube?

Duplication measures blocks of code that appear more than once. The default gate fails if more than 3% of new code is duplicated. Duplicates matter because a bug fixed in one copy often stays in the other.

26. What is technical debt?

Technical debt is the estimated time needed to fix maintainability issues. SonarQube adds up the remediation effort of each issue and shows it per project, which helps teams compare and plan clean-up work.

27. What is cognitive complexity?

It is a Sonar metric that scores how hard code is to understand, adding points for nested conditions, loops and breaks in linear flow. High values point to functions that should be split.

28. What is a Security Hotspot, and what is changing?

A Security Hotspot marks security-sensitive code that a developer must review to decide whether it needs a fix. A vulnerability needs a fix directly. Sonar's 2026.5 documentation says hotspots are being phased out: those rules now raise vulnerabilities in Standard Experience or security issues in MQR mode, and existing hotspot findings must be converted.

29. What happens when you mark an issue as false positive or accepted?

The issue stops counting against the project and the gate, and the decision is stored with a comment and history. Use it carefully: a reviewer should agree, and the reason should be written down.

30. Can SonarQube analyse pull requests?

Yes. Sonar documents pull request analysis for SonarQube Server and Cloud, which applies the quality gate to the changes in a PR and can show results in the DevOps platform. Check which edition your team runs, because feature availability differs between products.

Freshers moving up: CI and admin basics (31-36)

31. Where does SonarQube fit in a CI/CD pipeline?

After build and unit tests (so coverage reports exist) and before packaging or deployment. The usual flow is build, test, scan, wait for the quality gate, then continue only if it passes.

32. Show a simple Jenkins stage that runs a scan.

With the SonarQube Scanner plugin configured, withSonarQubeEnv injects the server URL and token, and waitForQualityGate pauses until the server reports the result (it needs a webhook from SonarQube to Jenkins).

stage('SonarQube') {
  steps {
    withSonarQubeEnv('sonar') {
      sh 'mvn -B verify sonar:sonar'
    }
  }
}
stage('Quality gate') {
  steps {
    timeout(time: 10, unit: 'MINUTES') {
      waitForQualityGate abortPipeline: true
    }
  }
}

Read more in why to integrate SonarQube into Jenkins.

33. What Linux settings does SonarQube Server need?

Because it embeds Elasticsearch, Sonar's Linux pre-installation page asks for vm.max_map_count of at least 524288 and fs.file-max of at least 131072, plus an open-file limit of 131072 for the SonarQube user.

# /etc/sysctl.d/99-sonarqube.conf
vm.max_map_count=524288
fs.file-max=131072

34. Which Java version does a ZIP install need?

The 2026.5 host requirements say Java 21 or Java 25 (a JDK) is required for ZIP installations. Docker images ship their own runtime.

35. What should you change right after a first login?

The try-out guide logs in as admin with password admin, so change that password immediately. Then create a non-admin token for CI and set up user groups and permissions.

36. What is a webhook in SonarQube used for?

A webhook notifies an external service (such as Jenkins) when the Compute Engine finishes processing an analysis, including the quality gate result. CI tools use it so they do not have to keep polling.

Beginner scenarios (37-40)

37. The scan step succeeds but nothing appears in the UI. What do you check?

Check the scanner log for the uploaded report URL, then open Administration and the background tasks list to see whether the Compute Engine failed. Also confirm the project key matches and the token has permission to execute analysis.

38. The quality gate fails on coverage even though tests pass. What is likely wrong?

The coverage report is missing, in a path the scanner does not read, or produced after the scan ran. Fix the order in the pipeline and set the correct report path property for your language.

39. A developer wants to ignore all issues in a legacy folder. What do you suggest?

Rely on the new code definition so old code does not block the gate, and use sonar.exclusions only for code that should never be analysed, such as generated files. Excluding real application code hides real problems.

40. The pipeline hangs at the quality gate step. Why?

Usually the webhook to the CI server is missing or blocked, so the CI tool never hears the result, or the Compute Engine queue is backed up. Check the webhook delivery status and the background tasks page, and set a timeout so the pipeline does not wait forever.

What to study next

Once these basics are solid, move to the advanced SonarQube questions and the real-time SonarQube questions. SonarQube is usually taught as part of DevSecOps pipelines; our DevSecOps training covers code scanning in CI, with classes in Kharadi, Pune and live online.

FAQ

Is SonarQube free?

SonarQube Community Build and SonarQube for IDE are free. SonarQube Server Developer, Enterprise and Data Center editions and SonarQube Cloud private projects are paid.

What is the default quality gate in SonarQube?

Sonar way. It checks new code for no new issues, reviewed Security Hotspots, at least 80% coverage and at most 3% duplication.

What is the difference between a quality profile and a quality gate?

A quality profile is the set of rules that raise issues. A quality gate is the set of pass or fail conditions applied to the results.

Does SonarQube run my unit tests?

No. It imports coverage and test reports created by your test tools during the build.

What port does SonarQube run on?

Port 9000 by default, as shown in Sonar's Docker try-out instructions.

Are Security Hotspots still used?

Sonar's 2026.5 documentation says they are being phased out, with those rules now raising vulnerabilities or security issues.

How do I fail a pipeline when the quality gate fails?

Set sonar.qualitygate.wait=true on the scanner, or use your CI plugin's quality gate step, such as waitForQualityGate in Jenkins.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.