C# Mastery Hub
Home
Challenges
Discussion
Lessons
Core Topics
C# Fundamentals
Console Applications
Classes & OOP
Windows Forms
ASP.NET Core
SQL Server
VS & SQL Connection
RDLC Reports
.NET MAUI
Getting Started
Getting Started
Website Development
SEO Guide
Security
Project Workflow
Extra Topics
Cloud & Deployment
AWS Cloud
Deployment
About
Contact
Test Your Knowledge
VS + SQL - Lesson 1: Connection Strings Quiz
Answer all questions to test your understanding
1
What is a connection string used for?
To tell your app how to find the database
To store user passwords
To configure logging
To set the application name
2
What authentication method uses your Windows credentials?
SQL Authentication
Windows Authentication
Azure Authentication
Basic Authentication
3
Where should you store connection strings in an ASP.NET Core app?
Hard-coded in the C# file
In appsettings.json
In the database
In a text file
4
What is the correct syntax for a SQL Server connection string?
Server=localhost;Database=SchoolDB;Trusted_Connection=True;
Server=localhost;Database=SchoolDB;UseWindowsAuth=True;
Host=localhost;Database=SchoolDB;Auth=Windows;
Data Source=localhost;DB=SchoolDB;WindowsAuth=true;
5
How do you read a connection string from appsettings.json in C#?
Configuration.GetConnectionString('SchoolDb')
Configuration.GetString('SchoolDb')
Configuration.GetValue('SchoolDb')
Configuration.Read('SchoolDb')
Submit Quiz