0% found this document useful (0 votes)
70 views17 pages

Backend Internship Test - Multiple Choice Questions

The document contains a series of multiple-choice questions designed to assess knowledge in Spring Boot, Python, PostgreSQL, and Django. Each question is followed by the correct answer, covering various topics such as annotations, database concepts, and programming principles. It serves as a test for candidates applying for a backend internship.

Uploaded by

gagan gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views17 pages

Backend Internship Test - Multiple Choice Questions

The document contains a series of multiple-choice questions designed to assess knowledge in Spring Boot, Python, PostgreSQL, and Django. Each question is followed by the correct answer, covering various topics such as annotations, database concepts, and programming principles. It serves as a test for candidates applying for a backend internship.

Uploaded by

gagan gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Backend Internship Test - Multiple Choice Questions

Spring Boot
1.​ Which annotation is used to create a REST controller in Spring Boot?​
a) @Controller​
b) @RestController​
c) @RequestMapping​
d) @Service​
Solution: b
2.​ What is the purpose of Spring Boot Actuator?​
a) To manage dependencies​
b) To configure the application context​
c) To monitor and manage the application​
d) To handle exceptions​
Solution: c
3.​ Which of the following is NOT a Spring Boot Starter?​
a) spring-boot-starter-web​
b) spring-boot-starter-data-jpa​
c) spring-boot-starter-security​
d) spring-boot-starter-core​
Solution: d
4.​ How do you define environment-specific properties in Spring Boot?​
a) Using @Value annotation​
b) Using application.properties file​
c) Using profile-specific files like application-dev.properties​
d) Using environment variables only​
Solution: c
5.​ What is Dependency Injection (DI) in Spring?​
a) Creating objects manually​
b) Managing object lifecycles​
c) Providing dependencies to objects from external sources​
d) Configuring application properties​
Solution: c
6.​ Which annotation is used to inject dependencies in Spring?​
a) @Bean​
b) @Component​
c) @Autowired​
d) @Inject​
Solution: c
7.​ What is the purpose of @RequestMapping annotation?​
a) To define a bean​
b) To map HTTP requests to handler methods​
c) To define a service​
d) To handle exceptions​
Solution: b
8.​ What is Spring Data JPA used for?​
a) Building web applications​
b) Simplifying database interactions​
c) Handling security​
d) Managing transactions​
Solution: b
9.​ Which annotation is used to define an entity in Spring Data JPA?​
a) @Table​
b) @Entity​
c) @Id​
d) @GeneratedValue​
Solution: b
10.​What is a Spring Boot profile?​
a) A set of dependencies​
b) A way to configure different application behaviors for different environments​
c) A security configuration​
d) A database configuration​
Solution: b
11.​ Which of the following is an advantage of Spring Boot?​
a) Complex configuration​
b) Slow development​
c) Rapid application development​
d) Requires external server deployment​
Solution: c
12.​What does the @SpringBootApplication annotation do?​
a) Defines a bean​
b) Enables auto-configuration, component scanning, and configuration​
c) Handles exceptions​
d) Defines a REST controller​
Solution: b
13.​How do you customize the port a Spring Boot application runs on?​
a) Using @Value annotation​
b) Setting server.port in application.properties or application.yml​
c) Using environment variables only​
d) It cannot be customized​
Solution: b
14.​What is the role of JpaRepository in Spring Data JPA?​
a) To define entities​
b) To provide pre-built methods for database operations​
c) To configure the database connection​
d) To handle transactions​
Solution: b
15.​What is JWT used for in Spring Security?​
a) Authorization​
b) Authentication​
c) Both authentication and authorization​
d) Data encryption​
Solution: c
16.​Which annotation is used to handle exceptions globally in Spring Boot?​
a) @ExceptionHandler​
b) @ControllerAdvice​
c) @RestControllerAdvice​
d) All of the above​
Solution: d
17.​What is Constructor Injection in Spring?​
a) Injecting dependencies via setter methods​
b) Injecting dependencies via fields​
c) Providing dependencies as constructor arguments​
d) Defining beans​
Solution: c
18.​What is the difference between @Component, @Service, and @Repository?​
a) They are all the same​
b) They are used for different layers of the application​
c) @Component is for controllers, @Service is for services, and @Repository is
for repositories​
d) They define beans​
Solution: b
19.​How do you define a one-to-many relationship in Spring Data JPA?​
a) @OneToOne​
b) @OneToMany​
c) @ManyToOne​
d) @ManyToMany​
Solution: b
20.​What is HATEOAS?​
a) A database management system​
b) A way to make APIs more discoverable​
c) A security protocol​
d) A testing framework​
Solution: b
Python
21.​Which of the following is NOT a built-in data type in Python?​
a) List​
b) Tuple​
c) Dictionary​
d) Array​
Solution: d
22.​What is the difference between == and is in Python?​
a) == compares values, is compares references​
b) == compares references, is compares values​
c) They are the same​
d) == is for numbers, is for strings​
Solution: a
23.​What is a Python virtual environment used for?​
a) Running multiple Python versions​
b) Isolating project dependencies​
c) Compiling Python code​
d) Debugging Python code​
Solution: b
24.​Which of the following is a popular Python web framework?​
a) Spring Boot​
b) Django​
c) Ruby on Rails​
d) Java Server Faces (JSF)​
Solution: b
25.​What is a decorator in Python?​
a) A design pattern​
b) A way to add functionality to functions​
c) A type of loop​
d) A way to define classes​
Solution: b
26.​What is the purpose of the try-except-finally block in Python?​
a) To define functions​
b) To handle exceptions​
c) To define loops​
d) To define classes​
Solution: b
27.​What is the Global Interpreter Lock (GIL) in Python?​
a) A security feature​
b) A memory management technique​
c) A mutex that prevents multiple threads from executing Python bytecode at the
same time​
d) A way to define global variables​
Solution: c
28.​What is a generator in Python?​
a) A function that returns a list​
b) A function that uses the yield keyword​
c) A way to define classes​
d) A type of loop​
Solution: b
29.​Which of the following is NOT a feature of Python?​
a) Dynamic typing​
b) Interpreted language​
c) Static typing​
d) Large standard library​
Solution: c
30.​What is the difference between a list and a tuple in Python?​
a) Lists are mutable, tuples are immutable​
b) Tuples are mutable, lists are immutable​
c) They are the same​
d) Lists are ordered, tuples are unordered​
Solution: a
31.​What is a dictionary in Python?​
a) An ordered collection of items​
b) An unordered collection of key-value pairs​
c) A type of loop​
d) A way to define classes​
Solution: b
32.​What are Python's virtual environments used for?​
a) Isolating project dependencies​
b) Running multiple Python versions concurrently​
c) Compiling Python code to machine code​
d) Optimizing Python code performance​
Solution: a
33.​Which data structure is best suited for storing unique, unordered items in Python?​
a) List​
b) Tuple​
c) Set​
d) Dictionary​
Solution: c
34.​What does the *args and **kwargs syntax do in Python function definitions?​
a) Defines default argument values​
b) Allows passing a variable number of arguments​
c) Specifies argument types​
d) Defines keyword-only arguments​
Solution: b
35.​How do you read and write files in Python?​
a) Using the file keyword​
b) Using the open() function​
c) Using the read() and write() functions directly​
d) Using the io module​
Solution: b
36.​What is the purpose of the __init__ method in a Python class?​
a) To define the class's methods​
b) To initialize the object's attributes​
c) To define class-level attributes​
d) To destroy the object​
Solution: b
37.​What is the difference between append() and extend() methods for lists in
Python?​
a) append() adds multiple elements, extend() adds a single element​
b) extend() adds multiple elements, append() adds a single element​
c) They do the same thing​
d) append() modifies the list in-place, extend() returns a new list​
Solution: b
38.​Which of the following is NOT a valid way to comment in Python?​
a) # This is a comment​
b) // This is a comment​
c) '''This is a multi-line comment'''​
d) """This is also a multi-line comment"""​
Solution: b
39.​What is the purpose of the pickle module in Python?​
a) To handle dates and times​
b) To serialize and deserialize Python objects​
c) To perform mathematical operations​
d) To work with regular expressions​
Solution: b
40.​How do you import modules in Python?​
a) Using the include keyword​
b) Using the import statement​
c) Using the require function​
d) Using the using keyword​
Solution: b
PostgreSQL
41.​What type of database is PostgreSQL?​
a) NoSQL​
b) Relational​
c) Graph​
d) Document​
Solution: b
42.​What does ACID stand for in database transactions?​
a) Atomicity, Consistency, Isolation, Durability​
b) Accuracy, Consistency, Integrity, Durability​
c) Atomicity, Correctness, Isolation, Durability​
d) Accuracy, Consistency, Isolation, Distribution​
Solution: a
43.​Which SQL command is used to retrieve data from a table?​
a) INSERT​
b) UPDATE​
c) SELECT​
d) DELETE​
Solution: c
44.​What is a primary key in a database table?​
a) A key used for sorting data​
b) A key that uniquely identifies each row​
c) A key used for indexing​
d) A key used for foreign key relationships​
Solution: b
45.​What is a foreign key?​
a) A key used for sorting data​
b) A key that uniquely identifies each row​
c) A key used for indexing​
d) A key that establishes a relationship between tables​
Solution: d
46.​What is the purpose of the JOIN clause in SQL?​
a) To filter data​
b) To sort data​
c) To combine rows from two or more tables​
d) To group data​
Solution: c
47.​What is an index in a database?​
a) A way to store data​
b) A way to speed up data retrieval​
c) A way to define relationships between tables​
d) A way to ensure data integrity​
Solution: b
48.​What is the difference between VARCHAR and TEXT data types in PostgreSQL?​
a) VARCHAR is for numbers, TEXT is for strings​
b) TEXT has a maximum length, VARCHAR does not​
c) VARCHAR has a maximum length, TEXT does not​
d) They are the same​
Solution: c
49.​What is the purpose of the GROUP BY clause in SQL?​
a) To filter data​
b) To sort data​
c) To combine rows from two or more tables​
d) To group rows that have the same values in specified columns into summary
rows​
Solution: d
50.​What is a transaction in a database?​
a) A single SQL statement​
b) A sequence of operations treated as a single logical unit of work​
c) A way to define tables​
d) A way to define indexes​
Solution: b
51.​What is the purpose of the WHERE clause in SQL?​
a) To sort data​
b) To filter data​
c) To group data​
d) To join tables​
Solution: b
52.​Which SQL command is used to update data in a table?​
a) INSERT​
b) UPDATE​
c) SELECT​
d) DELETE​
Solution: b
53.​How do you create a new table in PostgreSQL?​
a) CREATE TABLE table_name (column_definitions);​
b) NEW TABLE table_name (column_definitions);​
c) INSERT INTO table_name (column_definitions);​
d) SELECT * FROM table_name;​
Solution: a
54.​What is the purpose of the ORDER BY clause in SQL?​
a) To filter data​
b) To sort data​
c) To group data​
d) To join tables​
Solution: b
55.​What is the default isolation level in PostgreSQL?​
a) Read Uncommitted​
b) Read Committed​
c) Repeatable Read​
d) Serializable​
Solution: b
56.​What is the difference between DELETE and TRUNCATE in SQL?​
a) They do the same thing​
b) DELETE removes specific rows, TRUNCATE removes all rows​
c) TRUNCATE removes specific rows, DELETE removes all rows​
d) DELETE is faster than TRUNCATE​
Solution: b
57.​How do you add a new column to an existing table in PostgreSQL?​
a) ADD COLUMN column_name data_type;​
b) ALTER TABLE table_name ADD COLUMN column_name data_type;​
c) UPDATE TABLE table_name SET column_name = value;​
d) CREATE COLUMN column_name data_type;​
Solution: b
58.​What is the purpose of the HAVING clause in SQL?​
a) To filter rows after grouping​
b) To filter rows before grouping​
c) To sort data​
d) To join tables​
Solution: a
59.​What is a stored procedure in PostgreSQL?​
a) A way to store data​
b) A set of SQL statements that can be executed as a single unit​
c) A way to define tables​
d) A way to define indexes​
Solution: b
60.​What is the purpose of the EXPLAIN command in PostgreSQL?​
a) To execute a query​
b) To show the execution plan of a query​
c) To create a table​
d) To delete a table​
Solution: b
Django
61.​What is Django?​
a) A programming language​
b) A web framework​
c) A database management system​
d) An operating system​
Solution: b
62.​What does MVC stand for in the context of Django?​
a) Model, View, Controller​
b) Model, Template, View​
c) Model, View, Template​
d) Model, Template, Controller​
Solution: c
63.​What is the role of the models.py file in Django?​
a) To define URL patterns​
b) To define database schemas​
c) To define views​
d) To define templates​
Solution: b
64.​What is the Django ORM used for?​
a) Handling HTTP requests​
b) Interacting with the database using Python code​
c) Defining URL patterns​
d) Rendering HTML templates​
Solution: b
65.​What are Django views?​
a) HTML templates​
b) Python functions that handle HTTP requests​
c) Database models​
d) URL patterns​
Solution: b
66.​What are Django templates?​
a) Python functions​
b) HTML files with Django template language​
c) Database models​
d) URL patterns​
Solution: b
67.​What is the purpose of urls.py in a Django project or app?​
a) To define database models​
b) To map URLs to views​
c) To define HTML templates​
d) To configure settings​
Solution: b
68.​What is the Django admin interface?​
a) A command-line tool​
b) An automatically generated web interface for managing models​
c) A text editor for writing Django code​
d) A database management tool​
Solution: b
69.​What are Django migrations?​
a) Database queries​
b) Changes to the database schema​
c) HTML templates​
d) URL patterns​
Solution: b
70.​What is the purpose of Django middleware?​
a) To handle database connections​
b) To process requests and responses​
c) To define URL patterns​
d) To render templates​
Solution: b
Java
71.​Which of the following is NOT a Java access modifier?​
a) public​
b) private​
c) protected​
d) friend​
Solution: d
72.​What is the purpose of the static keyword in Java?​
a) To define a constant variable​
b) To create an object of a class​
c) To make a variable or method belong to the class, not an instance​
d) To prevent a method from being overridden​
Solution: c
73.​What is inheritance in Java?​
a) The ability of a class to derive properties and behaviors from another class​
b) The process of creating an object​
c) A way to define interfaces​
d) A mechanism for handling exceptions​
Solution: a
74.​What is polymorphism in Java?​
a) The ability of an object to take on many forms​
b) The process of defining multiple constructors​
c) A way to create abstract classes​
d) A mechanism for garbage collection​
Solution: a
75.​What is an interface in Java?​
a) A class that cannot be instantiated​
b) A blueprint of a class that specifies methods to be implemented​
c) A way to define constants​
d) A mechanism for handling events​
Solution: b
76.​What is an abstract class in Java?​
a) A class that cannot be instantiated​
b) A class that defines only abstract methods​
c) A class that is automatically garbage collected​
d) A class that is used for final methods​
Solution: a
77.​What is the difference between == and .equals() in Java?​
a) == compares object references, .equals() compares object values​
b) == compares object values, .equals() compares object references​
c) They are the same​
d) == is used for primitive types, .equals() is used for objects​
Solution: a
78.​What is an exception in Java?​
a) A syntax error​
b) An event that occurs during the execution of a program that disrupts the
normal flow​
c) A type of loop​
d) A way to define classes​
Solution: b
79.​Which of the following is a checked exception in Java?​
a) NullPointerException​
b) ArrayIndexOutOfBoundsException​
c) IOException​
d) RuntimeException​
Solution: c
80.​What is the purpose of the finally block in a try-catch statement?​
a) To handle exceptions​
b) To define a loop​
c) To define a class​
d) To execute code that should always run, regardless of whether an exception is
thrown​
Solution: d
MySQL
81.​What type of database is MySQL?​
a) NoSQL​
b) Relational​
c) Graph​
d) Document​
Solution: b
82.​Which SQL command is used to insert new data into a table?​
a) SELECT​
b) UPDATE​
c) INSERT​
d) DELETE​
Solution: c
83.​What is a primary key in a MySQL table?​
a) A key used for sorting data​
b) A key that uniquely identifies each row​
c) A key used for indexing​
d) A key used for foreign key relationships​
Solution: b
84.​What is a foreign key in MySQL?​
a) A key used for sorting data​
b) A key that uniquely identifies each row​
c) A key used for indexing​
d) A key that establishes a relationship between tables​
Solution: d
85.​What is the purpose of the JOIN clause in SQL?​
a) To filter data​
b) To sort data​
c) To combine rows from two or more tables​
d) To group data​
Solution: c
86.​What is an index in a MySQL database?​
a) A way to store data​
b) A way to speed up data retrieval​
c) A way to define relationships between tables​
d) A way to ensure data integrity​
Solution: b
87.​What is the difference between CHAR and VARCHAR data types in MySQL?​
a) CHAR is for numbers, VARCHAR is for strings​
b) VARCHAR has a fixed length, CHAR has a variable length​
c) CHAR has a fixed length, VARCHAR has a variable length​
d) They are the same​
Solution: c
88.​What is the purpose of the GROUP BY clause in SQL?​
a) To filter data​
b) To sort data​
c) To combine rows from two or more tables​
d) To group rows that have the same values in specified columns into summary
rows​
Solution: d
89.​What is a transaction in a MySQL database?​
a) A single SQL statement​
b) A sequence of operations treated as a single logical unit of work​
c) A way to define tables​
d) A way to define indexes​
Solution: b
90.​What is the purpose of the WHERE clause in SQL?​
a) To sort data​
b) To filter data​
c) To group data​
d) To join tables​
Solution: b
Spring Boot
91. What is Spring Boot?
a) A programming language.

b) A framework for building Java applications, especially web applications.

c) A database management system.

d) An operating system.
Solution: b
92.​What is Auto-configuration in Spring Boot?​
a) Manually configuring all the beans.​
b) Automatically configuring the Spring application based on the dependencies
present in the classpath.​
c) Configuring the application properties.​
d) Setting up the database connection.​
Solution: b
93.​How do you create a simple REST API in Spring Boot?​
a) By using the @Controller annotation.​
b) By using the @RestController annotation.​
c) By using the @RequestMapping annotation.​
d) By creating a class that implements RESTController.​
Solution: b
94.​What is Spring Data JPA?​
a) A library for creating RESTful APIs.​
b) A module that simplifies database access using the Java Persistence API (JPA).​
c) A security framework for Spring Boot.​
d) A tool for managing application dependencies.​
Solution: b
95.​What is a Spring Boot Starter?​
a) A set of tools for developing Spring Boot applications.​
b) A group of dependency descriptors that simplify the build configuration.​
c) A collection of code templates.​
d) A set of best practices for Spring Boot development.​
Solution: b
Django
96. What is Django?
a) A programming language.

b) A high-level Python web framework.

c) A database management system.

d) An operating system.
Solution: b
97.​What is an ORM in Django?​
a) Object Relational Mapping​
b) Object Request Mapping​
c) Object Route Mapping​
d) Object Relation Model​
Solution: a
98.​What are Django models?​
a) Python classes that define the structure of database tables.​
b) HTML templates.​
c) URL patterns.​
d) Views that handle HTTP requests.​
Solution: a
99.​What are Django views?​
a) HTML templates.​
b) Python functions or classes that handle HTTP requests and return responses.​
c) Database models.​
d) URL patterns.​
Solution: b
100.​ What are Django templates?​
a) Python functions.​
b) HTML files that can contain Django Template Language (DTL) tags.​
c) Database models.​
d) URL patterns.​
Solution: b

You might also like