shaileshjadhavSS commited on
Commit
2b130d1
·
1 Parent(s): 53f9c43

Solved start test button issue and Added python, django, Data engineering and common questions

Browse files
app.py CHANGED
@@ -5,35 +5,57 @@ from core.slack_notifier import SlackNotifier
5
  from core.questions_loader_local import QuestionLoaderLocal
6
  from presentation.layout import Layout
7
 
8
- import streamlit as st
9
-
10
-
11
  # Slack Webhook
12
  SLACK_WEBHOOK_URL = os.environ["SLACK_WEBHOOK_URL"]
13
  layout = Layout()
14
 
15
  def call():
16
- # Define questions
17
- questions = QuestionLoaderLocal(os.path.join(BASE_DIR, "questions", st.session_state['technology'].lower(), "questions.csv"), NUMBER_OF_TECHNICAL_QUESTIONS).fetch_questions()
18
- common_questions = QuestionLoaderLocal(os.path.join(BASE_DIR, "questions", "common", "questions.csv"), NUMBER_OF_COMMON_QUESTIONS).fetch_questions()
19
- questions.extend(common_questions)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  score = 0
21
  total_questions = len(questions)
 
22
 
23
  for idx, question in enumerate(questions):
24
  # Section for each question with styling
25
  selected_option = layout.render_test_question(question, idx)
26
-
27
- # Checking for correct answer and assigning points based on importance
 
28
  if selected_option == question['answer']:
29
  score += 1
30
 
31
-
32
  if st.button("Submit Test", use_container_width=True, type="primary"):
33
- st.session_state['test_started'] = False
34
- layout.render_completion_message(score, total_questions)
35
- SlackNotifier(SLACK_WEBHOOK_URL).send_candidate_info(st.session_state['name'], st.session_state['email'], st.session_state['experience'], st.session_state['technology'], (score/total_questions)*100)
36
-
 
 
 
 
 
 
 
 
 
 
37
 
38
  def main():
39
  # Set page config with custom title and layout
@@ -51,9 +73,11 @@ def main():
51
  st.session_state['email'] = email
52
  st.session_state['experience'] = experience
53
  st.session_state['technology'] = technology
54
- layout.render_instructions()
55
  if submit:
56
  st.session_state['test_started'] = True
 
 
57
  else:
58
  call()
59
 
 
5
  from core.questions_loader_local import QuestionLoaderLocal
6
  from presentation.layout import Layout
7
 
 
 
 
8
  # Slack Webhook
9
  SLACK_WEBHOOK_URL = os.environ["SLACK_WEBHOOK_URL"]
10
  layout = Layout()
11
 
12
  def call():
13
+ # Check if questions are already loaded
14
+ if 'questions' not in st.session_state:
15
+ # Define questions
16
+ questions = QuestionLoaderLocal(
17
+ os.path.join(BASE_DIR, "questions", st.session_state['technology'].lower(), "questions.csv"),
18
+ NUMBER_OF_TECHNICAL_QUESTIONS
19
+ ).fetch_questions()
20
+ common_questions = QuestionLoaderLocal(
21
+ os.path.join(BASE_DIR, "questions", "common", "questions.csv"),
22
+ NUMBER_OF_COMMON_QUESTIONS
23
+ ).fetch_questions()
24
+ questions.extend(common_questions)
25
+
26
+ # Store questions in session state to persist across interactions
27
+ st.session_state['questions'] = questions
28
+
29
+ # Retrieve the questions from session state
30
+ questions = st.session_state['questions']
31
  score = 0
32
  total_questions = len(questions)
33
+ answered_all = True
34
 
35
  for idx, question in enumerate(questions):
36
  # Section for each question with styling
37
  selected_option = layout.render_test_question(question, idx)
38
+ if not selected_option:
39
+ answered_all = False
40
+ # Checking for correct answer and assigning points based on difficulty
41
  if selected_option == question['answer']:
42
  score += 1
43
 
 
44
  if st.button("Submit Test", use_container_width=True, type="primary"):
45
+ if answered_all:
46
+ st.session_state['test_started'] = False
47
+ layout.render_completion_message(score, total_questions)
48
+ result = (score / total_questions) * 100
49
+ SlackNotifier(SLACK_WEBHOOK_URL).send_candidate_info(
50
+ st.session_state['name'],
51
+ st.session_state['email'],
52
+ st.session_state['experience'],
53
+ st.session_state['technology'],
54
+ f"{result:.2f}%"
55
+ )
56
+ else:
57
+ # Show a message asking the user to answer all questions
58
+ st.warning("Please answer all questions before submitting.")
59
 
60
  def main():
61
  # Set page config with custom title and layout
 
73
  st.session_state['email'] = email
74
  st.session_state['experience'] = experience
75
  st.session_state['technology'] = technology
76
+ st.session_state['test_wip'] = True
77
  if submit:
78
  st.session_state['test_started'] = True
79
+ st.rerun()
80
+ layout.render_instructions()
81
  else:
82
  call()
83
 
core/questions_loader_aws.py CHANGED
@@ -43,7 +43,7 @@ class QuestionLoaderAWS:
43
  "option3": row["option3"],
44
  "option4": row["option4"],
45
  "answer": row["answer"],
46
- "importance": row["importance"].lower()
47
  })
48
 
49
  return questions
 
43
  "option3": row["option3"],
44
  "option4": row["option4"],
45
  "answer": row["answer"],
46
+ "difficulty": row["difficulty"].lower()
47
  })
48
 
49
  return questions
core/questions_loader_dummy.py CHANGED
@@ -21,7 +21,7 @@ class QuestionLoaderDummy:
21
  "option3": "5",
22
  "option4": "6",
23
  "answer": "4",
24
- "importance": "high"
25
  },
26
  {
27
  "question": "What is 3*6?",
@@ -30,7 +30,7 @@ class QuestionLoaderDummy:
30
  "option3": "21",
31
  "option4": "24",
32
  "answer": "18",
33
- "importance": "low"
34
  },
35
  {
36
  "question": "What is 8/2?",
@@ -39,7 +39,7 @@ class QuestionLoaderDummy:
39
  "option3": "4",
40
  "option4": "5",
41
  "answer": "4",
42
- "importance": "medium"
43
  },
44
  {
45
  "question": "What is 5-3?",
@@ -48,6 +48,6 @@ class QuestionLoaderDummy:
48
  "option3": "3",
49
  "option4": "4",
50
  "answer": "2",
51
- "importance": "high"
52
  }
53
  ]
 
21
  "option3": "5",
22
  "option4": "6",
23
  "answer": "4",
24
+ "difficulty": "high"
25
  },
26
  {
27
  "question": "What is 3*6?",
 
30
  "option3": "21",
31
  "option4": "24",
32
  "answer": "18",
33
+ "difficulty": "low"
34
  },
35
  {
36
  "question": "What is 8/2?",
 
39
  "option3": "4",
40
  "option4": "5",
41
  "answer": "4",
42
+ "difficulty": "medium"
43
  },
44
  {
45
  "question": "What is 5-3?",
 
48
  "option3": "3",
49
  "option4": "4",
50
  "answer": "2",
51
+ "difficulty": "high"
52
  }
53
  ]
core/questions_loader_local.py CHANGED
@@ -39,7 +39,7 @@ class QuestionLoaderLocal:
39
  "option3": row["option3"],
40
  "option4": row["option4"],
41
  "answer": row["answer"],
42
- "importance": row["importance"].lower()
43
  })
44
  # Randomly select 20 questions
45
  sampled_questions = random.sample(questions, min(self.question_count, len(questions)))
 
39
  "option3": row["option3"],
40
  "option4": row["option4"],
41
  "answer": row["answer"],
42
+ "difficulty": row["difficulty"].lower()
43
  })
44
  # Randomly select 20 questions
45
  sampled_questions = random.sample(questions, min(self.question_count, len(questions)))
presentation/layout.py CHANGED
@@ -118,7 +118,8 @@ class Layout:
118
  [question['option1'], question['option2'], question['option3'], question['option4']],
119
  key=f"q{idx}",
120
  label_visibility="collapsed",
121
- help="Choose the correct answer"
 
122
  )
123
  st.markdown("---")
124
  return selected_option
@@ -131,4 +132,5 @@ class Layout:
131
  :param score: Total score obtained by the candidate.
132
  :param total: Total questions in the test.
133
  """
134
- st.success(f"Test completed! Your score: {score}/{total}")
 
 
118
  [question['option1'], question['option2'], question['option3'], question['option4']],
119
  key=f"q{idx}",
120
  label_visibility="collapsed",
121
+ help="Choose the correct answer",
122
+ index=None
123
  )
124
  st.markdown("---")
125
  return selected_option
 
132
  :param score: Total score obtained by the candidate.
133
  :param total: Total questions in the test.
134
  """
135
+ st.success("Test completed successfully! Great job on completing it. Thank you for your effort and dedication.")
136
+
questions/ai/questions.csv CHANGED
@@ -1,4 +1,4 @@
1
- question,option1,option2,option3,option4,answer,importance
2
  Question X,Option A,Option B,Option C,Option D,Answer,medium
3
  Question X,Option A,Option B,Option C,Option D,Answer,medium
4
  Question X,Option A,Option B,Option C,Option D,Answer,medium
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
  Question X,Option A,Option B,Option C,Option D,Answer,medium
3
  Question X,Option A,Option B,Option C,Option D,Answer,medium
4
  Question X,Option A,Option B,Option C,Option D,Answer,medium
questions/common/questions.csv CHANGED
@@ -1,36 +1,30 @@
1
- question,option1,option2,option3,option4,answer,importance
2
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
3
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
4
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
5
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
6
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
7
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
8
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
9
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
10
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
11
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
12
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
13
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
14
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
15
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
16
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
17
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
18
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
19
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
20
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
21
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
22
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
23
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
24
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
25
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
26
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
27
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
28
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
29
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
30
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
31
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
32
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
33
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
34
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
35
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
36
- Common Question,Option A,Option B,Option C,Option D,Answer,medium
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ "What is the most important factor when designing a scalable system?","Efficiency","Security","Performance","Maintainability","Maintainability","low"
3
+ "What is the main difference between a shallow copy and a deep copy of an object?","Shallow copy copies references, deep copy copies actual objects","Shallow copy copies values, deep copy copies references","Shallow copy doesn't copy mutable objects, deep copy does","No difference between the two","Shallow copy copies references, deep copy copies actual objects","low"
4
+ "What is the correct approach when debugging code that frequently breaks in production?","Write more unit tests","Increase logging to trace the error","Add try-except blocks everywhere","Revert to the last working version","Increase logging to trace the error","low"
5
+ "How do you handle race conditions in a multi-threaded environment?","Using locks or semaphores","By avoiding concurrency","By using atomic operations","By increasing the number of threads","Using locks or semaphores","low"
6
+ "Which of the following is the most important when writing maintainable code?","Naming conventions","Performance optimizations","Use of comments","Code duplication","Naming conventions","low"
7
+ "What is the correct way to handle version control conflicts in Git?","Delete the conflicting code","Manually resolve the conflict","Ignore the conflicts","Keep both versions of the code","Manually resolve the conflict","low"
8
+ "What is the best way to deal with unhandled exceptions in production?","Log the error and continue execution","Send an alert to the team and fail gracefully","Automatically restart the application","Ignore and hope the issue resolves itself","Send an alert to the team and fail gracefully","medium"
9
+ "What is the purpose of writing unit tests?","To ensure that the system works as intended during integration","To verify individual components behave as expected","To ensure system security","To generate documentation automatically","To verify individual components behave as expected","medium"
10
+ "What is a key benefit of Test-Driven Development (TDD)?","It helps you write better code in less time","It reduces the need for debugging","It guarantees fewer bugs in production","It makes the codebase more maintainable in the long term","It makes the codebase more maintainable in the long term","medium"
11
+ "What is the most important factor when choosing a database for a project?","Cost of the database","Ease of setup","Scalability and performance for your use case","Popularity among developers","Scalability and performance for your use case","medium"
12
+ "How would you handle a situation where a project is behind schedule and the team is underperforming?","Blame the team for poor performance","Reassign tasks to high performers","Communicate with stakeholders and adjust the project scope if needed","Ignore the issue and hope for improvement","Communicate with stakeholders and adjust the project scope if needed","medium"
13
+ "Which design pattern would you use to ensure that a class has only one instance in a program?","Factory Pattern","Singleton Pattern","Decorator Pattern","Observer Pattern","Singleton Pattern","medium"
14
+ "What is the purpose of continuous integration (CI)?","To reduce manual testing effort","To automatically merge code branches","To improve collaboration between developers","To detect integration problems early in the development process","To detect integration problems early in the development process","medium"
15
+ "What is the most efficient way to find duplicate values in a large list?","Sort the list and compare adjacent elements","Use a set to check for duplicates while iterating","Iterate through the list multiple times","Use a hash table","Use a set to check for duplicates while iterating","medium"
16
+ "How do you ensure that your code is scalable?","Focus on performance optimizations from the start","Design the system to handle increasing data volume and user load","Avoid using third-party libraries","Refactor code frequently to remove inefficiencies","Design the system to handle increasing data volume and user load","high"
17
+ "Which of the following is a good practice when working with cloud infrastructure?","Hard-code credentials in the codebase","Manually configure each service","Use environment variables for configuration management","Avoid automating infrastructure deployment","Use environment variables for configuration management","high"
18
+ "How do you ensure the security of an application?","By making sure the code is as fast as possible","By using secure coding practices and regularly reviewing security vulnerabilities","By reducing the number of external libraries","By limiting user access","By using secure coding practices and regularly reviewing security vulnerabilities","high"
19
+ "What is the most important skill a developer should have when working in a collaborative environment?","Ability to code quickly","Experience with debugging","Clear communication and teamwork skills","Deep knowledge of the technology stack","Clear communication and teamwork skills","high"
20
+ "What is the first step in identifying and solving performance bottlenecks in an application?","Profiling the application to identify the slow parts","Optimizing the entire codebase at once","Increasing server capacity","Reducing database queries","Profiling the application to identify the slow parts","high"
21
+ "How do you ensure the correctness of your code when working on a large project?","Write extensive documentation","Conduct regular code reviews and pair programming","Test the code only when necessary","Always work alone and avoid collaboration","Conduct regular code reviews and pair programming","high"
22
+ "How would you manage a project that requires frequent collaboration between multiple teams?","Work on tasks individually and combine them later","Keep communication channels open and hold regular sync meetings","Focus only on your own team’s work","Divide the project into isolated parts and have each team work independently","Keep communication channels open and hold regular sync meetings","high"
23
+ "What is your approach to learning a new programming language or technology?","Read the documentation thoroughly","Build a small project and learn as you go","Follow tutorials and courses","Rely on theoretical knowledge alone","Build a small project and learn as you go","high"
24
+ "What is the most important thing to consider when designing a REST API?","Making it RESTful","Making it easy to use and understand","Minimizing the number of endpoints","Designing it to be flexible with versioning","Making it easy to use and understand","high"
25
+ "How do you manage software dependencies in a project?","By hardcoding all dependencies in the codebase","By using a package manager or dependency manager","By manually installing and updating libraries","By avoiding dependencies as much as possible","By using a package manager or dependency manager","high"
26
+ "How do you handle situations where a product requirement changes mid-project?","Ignore the changes and continue working","Stop working until the change is fully clarified","Communicate with the stakeholders, adjust plans, and re-prioritize tasks","Resist the change and keep the original plan","Communicate with the stakeholders, adjust plans, and re-prioritize tasks","high"
27
+ "What is the correct approach to maintaining a balance between code quality and deadlines?","Write only enough code to meet the deadline","Prioritize code quality, even if it means missing deadlines","Find a balance by focusing on essential features while keeping code quality in check","Rush the code and test it later","Find a balance by focusing on essential features while keeping code quality in check","high"
28
+ "What is your approach when working with legacy code?","Rewrite the entire codebase","Test thoroughly, understand the existing code, and refactor carefully","Ignore the legacy code and focus only on new features","Add new features without considering the impact on existing functionality","Test thoroughly, understand the existing code, and refactor carefully","high"
29
+ "What is the importance of API documentation?","It is optional and can be skipped","It helps the team understand the endpoints and how to use them","It is only important for public APIs","It only serves as a marketing tool","It helps the team understand the endpoints and how to use them","high"
30
+ "What do you think is the most important quality of a good developer?","Speed of coding","Knowledge of algorithms","Attention to detail, problem-solving skills, and willingness to learn","Ability to work independently","Attention to detail, problem-solving skills, and willingness to learn","high"
 
 
 
 
 
 
questions/data engineering/questions.csv ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ "What is ETL in data engineering?","Extract, Transform, Load","Extract, Train, Load","Execute, Transfer, Log","Extract, Transform, List","Extract, Transform, Load","low"
3
+ "What is a data pipeline?","A sequence of data processing steps","A storage system for data","A process for loading data into a database","A type of data visualization","A sequence of data processing steps","low"
4
+ "What is Apache Kafka used for in data engineering?","Data storage","Real-time data streaming","Data warehousing","Data cleaning","Real-time data streaming","low"
5
+ "What is a data lake?","A large storage repository for raw data","A SQL database","A machine learning model","A type of data transformation","A large storage repository for raw data","low"
6
+ "What is the purpose of a data warehouse?","Store raw data","Transform data for processing","Store processed data for analysis","Generate data reports","Store processed data for analysis","low"
7
+ "What does Apache Spark do?","Data storage","Real-time data processing","Data transformation","Distributed computing for processing large datasets","Distributed computing for processing large datasets","low"
8
+ "What is the difference between batch processing and stream processing?","Batch is for real-time, stream is for scheduled tasks","Batch processes data in chunks, stream processes data in real-time","Batch is used for databases, stream is used for files","Batch stores data, stream processes data","Batch processes data in chunks, stream processes data in real-time","low"
9
+ "What is Hadoop?","A data processing framework","A data visualization tool","A machine learning model","A database system","A data processing framework","low"
10
+ "What is a NoSQL database?","A non-relational database","A database with no data","A relational database with flexible schemas","A database for storing unstructured data","A non-relational database","low"
11
+ "Which of the following is a columnar database?","MySQL","PostgreSQL","HBase","MongoDB","HBase","medium"
12
+ "What is a schema in a database?","A list of data points","A blueprint of how data is organized","A query language","A data transformation tool","A blueprint of how data is organized","medium"
13
+ "What is Apache Airflow used for?","Data storage","Data processing","Orchestrating workflows","Data analysis","Orchestrating workflows","medium"
14
+ "What is a data model?","A way of organizing data for storage and analysis","A tool for transforming data","A type of database system","A reporting tool","A way of organizing data for storage and analysis","medium"
15
+ "What is the difference between OLTP and OLAP?","OLTP is for transaction processing, OLAP is for data analysis","OLTP is for data analytics, OLAP is for real-time data storage","OLTP processes data in real-time, OLAP stores data in batches","OLTP stores data, OLAP processes it","OLTP is for transaction processing, OLAP is for data analysis","medium"
16
+ "How does data normalization work?","Storing data in a compressed format","Breaking down data into smaller pieces for easier storage","Ensuring data is consistent and avoids redundancy","Converting data into an encrypted format","Ensuring data is consistent and avoids redundancy","medium"
17
+ "What is the purpose of indexing in a database?","To store data efficiently","To speed up data retrieval","To back up data","To validate data integrity","To speed up data retrieval","medium"
18
+ "What is data partitioning?","Dividing large datasets into smaller, manageable pieces","Transforming data for reporting","Storing data in a compressed format","Creating backups of data","Dividing large datasets into smaller, manageable pieces","medium"
19
+ "What is a relational database?","A database that stores data in tables with relationships","A database that stores raw data","A database that doesn’t use schemas","A database designed for unstructured data","A database that stores data in tables with relationships","medium"
20
+ "What is a foreign key in a database?","A unique identifier for a record","A field that links two tables together","A type of index","A tool for data normalization","A field that links two tables together","medium"
21
+ "What is the purpose of data cleaning?","To process raw data for storage","To remove inconsistencies and inaccuracies in data","To create reports from data","To back up data for future use","To remove inconsistencies and inaccuracies in data","high"
22
+ "What is Apache Flink used for?","Data storage","Data transformation","Real-time data stream processing","Batch processing","Real-time data stream processing","high"
23
+ "How does a data pipeline handle failures?","It retries until successful","It stops and alerts the user","It logs the error and proceeds with a backup plan","It silently skips the data","It logs the error and proceeds with a backup plan","high"
24
+ "What is the purpose of an API in data engineering?","To store and process data","To enable communication between systems","To encrypt data","To clean data","To enable communication between systems","high"
25
+ "What is data governance?","Managing the integrity, security, and availability of data","The process of cleaning data","A type of database schema","A method of storing data in the cloud","Managing the integrity, security, and availability of data","high"
26
+ "What is a relational algebra operation?","A way of transforming relational data into visual reports","A mathematical operation for querying databases","A tool for data modeling","A type of data cleaning process","A mathematical operation for querying databases","high"
27
+ "What is CDC (Change Data Capture)?","A data transformation process","A technique for identifying and capturing changes in data over time","A method for removing duplicate data","A data warehousing technique","A technique for identifying and capturing changes in data over time","high"
28
+ "How do you manage big data?","By using NoSQL databases only","By storing it in filesystems","By splitting it into smaller chunks for parallel processing","By using relational databases only","By splitting it into smaller chunks for parallel processing","high"
29
+ "What is MapReduce?","A way of storing data","A technique for distributed data processing","A tool for visualizing data","A data analysis method","A technique for distributed data processing","high"
30
+ "What is cloud computing in data engineering?","Using on-premises servers for data storage","Storing data in a centralized database","Storing and processing data using remote servers and services","Using external hard drives for backup","Storing and processing data using remote servers and services","high"
31
+ "What is data sharding?","Dividing a large dataset into smaller, distributed parts","Encrypting data","Storing data in multiple formats","A data transformation technique","Dividing a large dataset into smaller, distributed parts","high"
32
+ "How do you perform data transformation?","By using SQL queries only","By using ETL tools or scripts","By manually changing data in databases","By storing data in different formats","By using ETL tools or scripts","high"
33
+ "What is the output of: print(type([]))?","list","tuple","dict","set","list","low"
34
+ "How do you declare a variable in Python?","var x = 10","int x = 10","x = 10","declare x = 10","x = 10","low"
35
+ "What does the len() function do?","Returns length of a sequence","Returns a list","Converts string to list","Creates a dictionary","Returns length of a sequence","low"
36
+ "Which of the following is a valid Python data type?","integer","float","string","All of the above","All of the above","low"
37
+ "How do you define a function in Python?","fun my_function()","def my_function()","function my_function()","None of the above","def my_function()","low"
38
+ "What is the output of: print(3 * 'Python')?","PythonPythonPython","Error","Python3","None","PythonPythonPython","medium"
39
+ "Which method is used to add an element to a set?","add()","append()","insert()","extend()","add()","medium"
40
+ "What is the output of: print(5 // 2)?","2.5","2","3","Error","2","medium"
41
+ "How do you handle exceptions in Python?","try-catch","try-finally","try-except","try-else","try-except","medium"
42
+ "What is a Python decorator?","A function returning another function","A type of module","A Python class","A data structure","A function returning another function","high"
43
+ "How do you define a lambda function in Python?","lambda x: x * 2","def lambda x: x * 2","lambda x => x * 2","None of the above","lambda x: x * 2","high"
44
+ "What is the time complexity of accessing an element in a dictionary?","O(1)","O(n)","O(log n)","O(n^2)","O(1)","high"
45
+ "How do you create a virtual environment in Python?","python3 -m venv venv","virtualenv venv","venv create venv","None of the above","python3 -m venv venv","high"
46
+ "What is the output of: print('Python'[::-1])?","nohtyP","Python","Error","None","nohtyP","high"
47
+ "What is the purpose of the 'continue' statement in Python?","Exits the loop","Skips the current iteration","Pauses the loop","None of the above","Skips the current iteration","high"
48
+ "What does the map() function do in Python?","Applies a function to all items in an iterable","Combines two lists","Filters out elements from a list","None of the above","Applies a function to all items in an iterable","high"
49
+ "How do you check if a key exists in a dictionary?","key in dict","dict.has_key(key)","key in dict.keys()","None of the above","key in dict","high"
questions/django/questions.csv ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ "What is the default port for Django development server?","8000","8080","5000","9000","8000","low"
3
+ "What is a Django model?","A class that defines the structure of a database table","A view to render data to the template","A URL route handler","None of the above","A class that defines the structure of a database table","low"
4
+ "Which command is used to start a Django project?","django-admin startproject","python manage.py startproject","django startproject","python startproject","django-admin startproject","low"
5
+ "What is the purpose of Django’s ORM?","Handle HTTP requests","Map database tables to Python objects","Define HTML templates","Manage static files","Map database tables to Python objects","low"
6
+ "What is the output of: print(2 + 3 * 4) in Django view?","14","20","16","10","14","low"
7
+ "What is the Django admin?","A tool to manage database tables","A module to create URLs","A view for user authentication","A web interface for managing application data","A web interface for managing application data","low"
8
+ "What is the default database engine used by Django?","SQLite","MySQL","PostgreSQL","Oracle","SQLite","low"
9
+ "How do you make a model field optional in Django?","null=True","blank=True","optional=True","both null=True and blank=True","both null=True and blank=True","low"
10
+ "How do you include a URL path in Django?","Include it in views.py","Use the url() function in urls.py","Use the path() function in urls.py","Both b and c","Both b and c","low"
11
+ "What is the purpose of Django middleware?","Handle HTTP responses","Manage user sessions","Intercept requests and responses globally","Handle templates rendering","Intercept requests and responses globally","medium"
12
+ "What is the Django context in templates?","Data passed from views to templates","HTML data in the template","URL parameters passed in request","Session data","Data passed from views to templates","medium"
13
+ "Which of the following is used to display a static file in Django?","django.contrib.staticfiles","django.contrib.files","django.contrib.contenttypes","None of the above","django.contrib.staticfiles","medium"
14
+ "What is the purpose of Django's 'migrations'?","To handle database changes automatically","To handle requests from the server","To perform a data transformation","To manage user permissions","To handle database changes automatically","medium"
15
+ "Which function in Django is used to render a template?","render()","template()","render_template()","render_page()","render()","medium"
16
+ "What is the Django settings file?","A file that contains configuration for the project","A file for database models","A file for storing views","A file to store static files","A file that contains configuration for the project","medium"
17
+ "How can you limit the number of items in a queryset in Django?","Using .filter()","Using .exclude()","Using .limit()","Using .[:n]","Using .[:n]","medium"
18
+ "What is the Django REST Framework?","A framework for creating RESTful APIs","A web server to handle requests","A module for managing templates","A tool for database migrations","A framework for creating RESTful APIs","medium"
19
+ "How do you create a custom manager in Django?","By subclassing models.Manager","By adding methods to the model class","By using the model’s save() method","By defining custom views","By subclassing models.Manager","medium"
20
+ "What is Django's 'signals' feature used for?","For sending email notifications","For triggering events between models and views","For creating scheduled tasks","For caching data","For triggering events between models and views","high"
21
+ "What is the function used to run migrations in Django?","python manage.py migrate","python manage.py update","python manage.py syncdb","python manage.py makemigrations","python manage.py migrate","high"
22
+ "What is the Django queryset?","An object for querying the database","A function to create URLs","A view handler","A module to generate reports","An object for querying the database","high"
23
+ "How do you secure sensitive data in Django settings?","By using environment variables","By hardcoding the secrets in settings.py","By using the Django secret key generator","By using default values in settings.py","By using environment variables","high"
24
+ "What is the purpose of the Django signals module?","To send and receive messages within the application","To manage database migrations","To render templates","To handle sessions in Django","To send and receive messages within the application","high"
25
+ "How do you add a custom command in Django?","By defining a management command in apps.py","By creating a custom script in the root folder","By adding to the settings.py file","By subclassing Command class in a management/commands folder","By subclassing Command class in a management/commands folder","high"
26
+ "How do you define a foreign key relationship in Django models?","Using ForeignKey()","Using OneToOneField()","Using ManyToManyField()","Using RelationshipField()","Using ForeignKey()","high"
27
+ "What is Django’s 'get_object_or_404' used for?","To retrieve a model object or return a 404 error if not found","To check if an object exists in the database","To handle request errors in views","To redirect to a different page if an object doesn’t exist","To retrieve a model object or return a 404 error if not found","high"
28
+ "What is Django’s 'csrf_token' used for?","To prevent cross-site scripting attacks","To handle form submissions safely","To manage user sessions securely","To prevent cross-site request forgery attacks","To prevent cross-site request forgery attacks","high"
29
+ "How do you create a new Django app?","django-admin startapp app_name","python manage.py startapp app_name","python startapp app_name","django startapp app_name","django-admin startapp app_name","high"
30
+ "What does Django’s 'context' contain?","Data passed to templates from views","User request data","Session data","Model data","Data passed to templates from views","high"
31
+ "How do you define a many-to-many relationship in Django?","Using ManyToManyField()","Using ForeignKey()","Using OneToOneField()","Using ManyToManyField() in views","Using ManyToManyField()","high"
32
+ "What is the Django shell used for?","Testing models and queries interactively","To run server commands","To manage static files","To manage user sessions","Testing models and queries interactively","high"
33
+ "How do you add a static file in Django?","By placing it in a static folder","By using the static() function in views","By adding it to settings.py","By including a link in templates","By placing it in a static folder","high"
34
+ "What is the function used to create a new Django superuser?","python manage.py createsuperuser","python manage.py superuser","python manage.py makeuser","python manage.py addsuperuser","python manage.py createsuperuser","high"
35
+ "How do you declare a variable in Python?","var x = 10","int x = 10","x = 10","declare x = 10","x = 10","low"
36
+ "What is the output of: print(type([]))?","list","tuple","dict","set","list","low"
37
+ "What does the len() function do?","Returns length of a sequence","Returns a list","Converts string to list","Creates a dictionary","Returns length of a sequence","low"
38
+ "Which of the following is a valid Python data type?","integer","float","string","All of the above","All of the above","low"
39
+ "How do you declare a function in Python?","fun my_function()","def my_function()","function my_function()","None of the above","def my_function()","low"
40
+ "What is the output of: print(3 * 'Python')?","PythonPythonPython","Error","Python3","None","PythonPythonPython","medium"
41
+ "Which method is used to add an element to a set?","add()","append()","insert()","extend()","add()","medium"
42
+ "What is the output of: print(5 // 2)?","2.5","2","3","Error","2","medium"
43
+ "How do you handle exceptions in Python?","try-catch","try-finally","try-except","try-else","try-except","medium"
44
+ "What is a Python decorator?","A function returning another function","A type of module","A Python class","A data structure","A function returning another function","high"
45
+ "How do you define a lambda function in Python?","lambda x: x * 2","def lambda x: x * 2","lambda x => x * 2","None of the above","lambda x: x * 2","high"
46
+ "What is the time complexity of accessing an element in a dictionary?","O(1)","O(n)","O(log n)","O(n^2)","O(1)","high"
47
+ "How do you create a virtual environment in Python?","python3 -m venv venv","virtualenv venv","venv create venv","None of the above","python3 -m venv venv","high"
48
+ "What is the output of: print('Python'[::-1])?","nohtyP","Python","Error","None","nohtyP","high"
49
+ "What is the purpose of the 'continue' statement in Python?","Exits the loop","Skips the current iteration","Pauses the loop","None of the above","Skips the current iteration","high"
50
+ "What does the map() function do in Python?","Applies a function to all items in an iterable","Combines two lists","Filters out elements from a list","None of the above","Applies a function to all items in an iterable","high"
51
+ "How do you check if a key exists in a dictionary?","key in dict","dict.has_key(key)","key in dict.keys()","None of the above","key in dict","high"
52
+ "How do you remove an item from a list by index?","list.remove(index)","list.pop(index)","del list[index]","None of the above","list.pop(index)","high"
53
+ "What is the output of: print([i**2 for i in range(3)])?","[0, 1, 4]","[1, 4, 9]","[0, 2, 4]","[1, 2, 3]","[0, 1, 4]","high"
54
+ "How do you round a number in Python?","round(number)","round(number, 2)","floor(number)","ceil(number)","round(number, 2)","high"
questions/python/questions.csv CHANGED
@@ -1,16 +1,46 @@
1
- question,option1,option2,option3,option4,answer,importance
2
- What is the output of: print(type([]))?,list,tuple,dict,set,list,low
3
- Which keyword is used to define a function in Python?,fun,function,def,define,def,low
4
- What does the len() function do?,Returns length of a sequence,Returns a list,Converts string to list,Creates a dictionary,Returns length of a sequence,low
5
- How do you declare a variable in Python?,var x = 10,x = 10,int x = 10,declare x = 10,x = 10,low
6
- Which of the following is a valid Python data type?,integer,float,string,All of the above,All of the above,low
7
- What is the output of: print(3 * 'Python')?,PythonPythonPython,Error,Python3,None,PythonPythonPython,medium
8
- Which method is used to add an element to a set?,add(),append(),insert(),extend(),add(),medium
9
- What is the output of: print(5 // 2)?,2.5,2,3,Error,2,medium
10
- What is the correct syntax to create a dictionary?,{key: value},[key: value],(key: value),key: value,{key: value},medium
11
- How do you handle exceptions in Python?,try-catch,try-finally,try-except,try-else,try-except,medium
12
- What is a Python decorator?,A function returning another function,A type of module,A Python class,A data structure,A function returning another function,high
13
- What is the purpose of the 'with' statement?,Memory management,Simplify exception handling,File handling and cleanup,All of the above,All of the above,high
14
- What is the time complexity of accessing an element in a dictionary?,O(1),O(n),O(log n),O(n^2),O(1),high
15
- Which module is used for multithreading in Python?,multiprocessing,threading,os,subprocess,threading,high
16
- What is the output of: print([i**2 for i in range(3)])?,"[0, 1, 4]","[1, 4, 9]","[0, 2, 4]","[1, 2, 3]","[0, 1, 4]",high
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ "What is the output of: print(type({}))","dict","list","set","tuple","dict","low"
3
+ "What keyword is used to define a function in Python?","fun","def","function","define","def","low"
4
+ "What does the input() function do?","Reads user input","Converts input to int","Reads user input and converts to int","None of the above","Reads user input","low"
5
+ "How do you declare a variable in Python?","var x = 10","int x = 10","x = 10","declare x = 10","x = 10","low"
6
+ "What is the output of: print(len('Hello'))?","5","6","Hello","Error","5","low"
7
+ "What is the valid way to define a class in Python?","class MyClass()","def MyClass:","class MyClass:","define MyClass","class MyClass:","low"
8
+ "What is the output of: print(10 / 2)?","5.0","5","10","Error","5.0","low"
9
+ "What does the range() function do?","Generates a sequence of numbers","Creates a list of numbers","Generates a string sequence","None of the above","Generates a sequence of numbers","low"
10
+ "What is the output of: print(3 + 2 * 2)?","7","10","8","5","7","low"
11
+ "Which of the following is a valid Python data type?","integer","float","string","All of the above","All of the above","low"
12
+ "How do you define a default parameter in a function?","def func(x = 5)","def func(x: 5)","func(x = 5)","None of the above","def func(x = 5)","low"
13
+ "What is the output of: print(2 ** 3)?","8","6","3","2","8","low"
14
+ "What does the del statement do?","Deletes a variable","Deletes a list item","Deletes an object","All of the above","All of the above","low"
15
+ "What is the output of the following code: print(isinstance(3.14, (int, float)))?","True","False","Error","None of the above","True","high"
16
+ "What is the output of: print([1, 2, 3] + [4, 5])?","[1, 2, 3, 4, 5]","[1, 2, 3] + [4, 5]","[5, 4, 3, 2, 1]","Error","[1, 2, 3, 4, 5]","low"
17
+ "How do you create a set in Python?","set([1, 2, 3])","[1, 2, 3]","(1, 2, 3)","set(1, 2, 3)","set([1, 2, 3])","medium"
18
+ "What is the output of: print(10 % 3)?","1","3","2","Error","1","medium"
19
+ "What is the purpose of the 'break' statement in Python?","Exits a loop","Pauses a loop","Continues the loop","None of the above","Exits a loop","medium"
20
+ "How do you declare a class in Python?","class MyClass()","class MyClass:","MyClass()","None of the above","class MyClass:","medium"
21
+ "What is the correct way to check if a list is empty?","if list == []:","if list:","if len(list) == 0:","None of the above","if not list:","medium"
22
+ "Which of the following is a Python built-in data structure?","list","tuple","dict","All of the above","All of the above","medium"
23
+ "What is the output of: print([i**2 for i in range(3)])?","[0, 1, 4]","[1, 4, 9]","[0, 2, 4]","[1, 2, 3]","[0, 1, 4]","medium"
24
+ "What is the purpose of the 'pass' statement in Python?","Skips the current iteration of the loop","Exits the loop","Used as a placeholder","None of the above","Used as a placeholder","medium"
25
+ "How do you open a file in Python?","open('file.txt')","open('file.txt', 'r')","open('file.txt', 'w')","All of the above","All of the above","medium"
26
+ "What is the correct syntax to create a dictionary?","{key: value}","[key: value]","(key: value)","key: value","{key: value}","medium"
27
+ "Which function is used to get the length of a string?","size()","length()","len()","count()","len()","medium"
28
+ "What is the output of: print(5 // 2)?","2.5","2","3","Error","2","medium"
29
+ "How do you handle exceptions in Python?","try-catch","try-finally","try-except","try-else","try-except","medium"
30
+ "What is a Python decorator?","A function returning another function","A type of module","A Python class","A data structure","A function returning another function","high"
31
+ "What is the purpose of the 'with' statement?","Memory management","Simplify exception handling","File handling and cleanup","All of the above","All of the above","high"
32
+ "What is the time complexity of accessing an element in a dictionary?","O(1)","O(n)","O(log n)","O(n^2)","O(1)","high"
33
+ "What module is used for multithreading in Python?","multiprocessing","threading","os","subprocess","threading","high"
34
+ "How do you create a virtual environment in Python?","python3 -m venv venv","virtualenv venv","venv create venv","None of the above","python3 -m venv venv","high"
35
+ "What is the difference between 'is' and '==' in Python?","'is' compares values, '==' compares identities","'is' compares identities, '==' compares values","Both compare values","Both compare identities","'is' compares identities, '==' compares values","high"
36
+ "What is the output of: print('Hello' == 'Hello')?","True","False","None","Error","True","high"
37
+ "How do you define a lambda function in Python?","lambda x: x * 2","def lambda x: x * 2","lambda x => x * 2","None of the above","lambda x: x * 2","high"
38
+ "What does the map() function do in Python?","Applies a function to all items in an iterable","Combines two lists","Filters out elements from a list","None of the above","Applies a function to all items in an iterable","high"
39
+ "How do you remove an item from a list by index?","list.remove(index)","list.pop(index)","del list[index]","None of the above","list.pop(index)","high"
40
+ "What is the output of: print('Python'[::-1])?","nohtyP","Python","Error","None","nohtyP","high"
41
+ "What is the purpose of the 'continue' statement in Python?","Exits the loop","Skips the current iteration","Pauses the loop","None of the above","Skips the current iteration","high"
42
+ "What is the output of: print([i for i in range(5) if i % 2 == 0])?","[0, 2, 4]","[1, 3]","[2, 4]","[0, 1, 2, 3, 4]","[0, 2, 4]","high"
43
+ "How can you check if a key exists in a dictionary?","key in dict","dict.has_key(key)","key in dict.keys()","None of the above","key in dict","high"
44
+ "What is the output of: print(sorted([3, 1, 2]))?","[1, 2, 3]","[3, 2, 1]","[2, 1, 3]","[1, 3, 2]","[1, 2, 3]","high"
45
+ "What is the output of: print('abc'.replace('b', 'd'))?","adc","abd","dcd","abcd","adc","high"
46
+ "How do you round a number in Python?","round(number)","round(number, 2)","floor(number)","ceil(number)","round(number, 2)","high"