shaileshjadhavSS commited on
Commit
f187aae
Β·
1 Parent(s): a709932

Added generate url UI adn validation

Browse files
app.py CHANGED
@@ -1,4 +1,7 @@
1
  import os
 
 
 
2
  import streamlit as st
3
  from settings import BASE_DIR, NUMBER_OF_TECHNICAL_QUESTIONS, NUMBER_OF_COMMON_QUESTIONS
4
  from core.slack_notifier import SlackNotifier
@@ -9,12 +12,12 @@ from presentation.layout import Layout
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
 
@@ -23,7 +26,7 @@ def call():
23
  return
24
 
25
  common_questions = QuestionLoaderLocal(
26
- os.path.join(BASE_DIR, "questions", "common", "questions.csv"),
27
  NUMBER_OF_COMMON_QUESTIONS
28
  ).fetch_questions()
29
  questions.extend(common_questions)
@@ -51,6 +54,7 @@ def call():
51
  st.session_state['test_started'] = False
52
  layout.render_completion_message(score, total_questions)
53
  result = (score / total_questions) * 100
 
54
  SlackNotifier(SLACK_WEBHOOK_URL).send_candidate_info(
55
  st.session_state['name'],
56
  st.session_state['email'],
@@ -62,29 +66,98 @@ def call():
62
  # Show a message asking the user to answer all questions
63
  st.warning("Please answer all questions before submitting.")
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  def main():
 
 
 
 
 
 
 
66
  # Set page config with custom title and layout
67
  st.set_page_config(page_title="Candidate MCQ Platform", layout="wide")
68
  layout.render_header()
 
 
 
 
 
69
 
70
- if 'test_started' not in st.session_state:
71
- st.session_state['test_started'] = False
72
-
73
- if not st.session_state['test_started']:
74
- st.title("Welcome to the Candidate Assessment Platform")
75
- name, email, experience, technology, submit = layout.render_signup_form()
76
- if name and email:
77
- st.session_state['name'] = name
78
- st.session_state['email'] = email
79
- st.session_state['experience'] = experience
80
- st.session_state['technology'] = technology
81
- st.session_state['test_wip'] = True
82
- if submit:
83
- st.session_state['test_started'] = True
84
- st.rerun()
85
- layout.render_instructions()
86
- else:
87
- call()
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  if __name__ == "__main__":
90
  main()
 
1
  import os
2
+ import csv
3
+ import uuid
4
+ from datetime import datetime
5
  import streamlit as st
6
  from settings import BASE_DIR, NUMBER_OF_TECHNICAL_QUESTIONS, NUMBER_OF_COMMON_QUESTIONS
7
  from core.slack_notifier import SlackNotifier
 
12
  SLACK_WEBHOOK_URL = os.environ["SLACK_WEBHOOK_URL"]
13
  layout = Layout()
14
 
15
+ def call(candidate_id):
16
  # Check if questions are already loaded
17
  if 'questions' not in st.session_state:
18
  # Define questions
19
  questions = QuestionLoaderLocal(
20
+ os.path.join(BASE_DIR, "data/questions", st.session_state['technology'].lower(), "questions.csv"),
21
  NUMBER_OF_TECHNICAL_QUESTIONS
22
  ).fetch_questions()
23
 
 
26
  return
27
 
28
  common_questions = QuestionLoaderLocal(
29
+ os.path.join(BASE_DIR, "data/questions", "common", "questions.csv"),
30
  NUMBER_OF_COMMON_QUESTIONS
31
  ).fetch_questions()
32
  questions.extend(common_questions)
 
54
  st.session_state['test_started'] = False
55
  layout.render_completion_message(score, total_questions)
56
  result = (score / total_questions) * 100
57
+ update_candidate_status(candidate_id, result)
58
  SlackNotifier(SLACK_WEBHOOK_URL).send_candidate_info(
59
  st.session_state['name'],
60
  st.session_state['email'],
 
66
  # Show a message asking the user to answer all questions
67
  st.warning("Please answer all questions before submitting.")
68
 
69
+ def generate_url():
70
+ id = uuid.uuid4().hex # Generate a UUID and convert it to a hex string
71
+ return f'http://localhost:8501/?candidate_id={id}', id
72
+
73
+ def add_candidate_id_to_csv(candidate_id):
74
+ with open(os.path.join(BASE_DIR, "data", "candidates.csv"), 'a') as file:
75
+ csv.writer(file).writerow([candidate_id,"","","","","","","In Progress"])
76
+
77
+ def read_candidate_csv():
78
+ with open(os.path.join(BASE_DIR, "data", "candidates.csv"), 'r') as file:
79
+ reader = csv.DictReader(file)
80
+ return list(reader)
81
+
82
+ def is_candidate_test_completed(candidate_id, candidates):
83
+ for row in candidates:
84
+ if row["id"].lower() == candidate_id.lower() and row["status"] == "Test Completed":
85
+ return True
86
+ return False
87
+
88
+ def is_valid_candidate_id(candidate_id, candidates):
89
+ for row in candidates:
90
+ if row["id"].lower() == candidate_id:
91
+ return True
92
+ return False
93
+
94
+ def update_candidate_status(candidate_id, result):
95
+ with open(os.path.join(BASE_DIR, "data", "candidates.csv"), 'r') as file:
96
+ reader = csv.reader(file)
97
+ header = next(reader) # Save the header
98
+ rows = []
99
+ for row in reader:
100
+ if row[0] == candidate_id:
101
+ row[1] = st.session_state['name']
102
+ row[2] = st.session_state['email']
103
+ row[3] = st.session_state['experience']
104
+ row[4] = st.session_state['technology']
105
+ row[5] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
106
+ row[6] = result
107
+ row[7] = "Test Completed"
108
+ rows.append(row)
109
+ with open(os.path.join(BASE_DIR, "data", "candidates.csv"), 'w') as file:
110
+
111
+ writer = csv.writer(file)
112
+ writer.writerow(header) # Write the header
113
+ writer.writerows(rows)
114
+
115
  def main():
116
+ query_params = st.query_params
117
+ if not query_params:
118
+ st.markdown("Invalid URL")
119
+ return
120
+
121
+ candidate_id = query_params.get("candidate_id", None)
122
+ internal = query_params.get("internal", None)
123
  # Set page config with custom title and layout
124
  st.set_page_config(page_title="Candidate MCQ Platform", layout="wide")
125
  layout.render_header()
126
+ if internal:
127
+ if st.button('Generate URL'):
128
+ url, candidate_id = generate_url()
129
+ st.write(f"Generated URL: {url}")
130
+ add_candidate_id_to_csv(candidate_id)
131
 
132
+ elif candidate_id:
133
+ candidates = read_candidate_csv()
134
+ if not is_valid_candidate_id(candidate_id, candidates):
135
+ st.markdown("Invalid URL")
136
+ return
137
+ print("Candidate ID:", candidate_id)
138
+ if is_candidate_test_completed(candidate_id, candidates):
139
+ st.markdown("Test has been completed! Great job on completing it. Thank you for your effort and dedication.")
140
+ return
141
+
142
+ if 'test_started' not in st.session_state:
143
+ st.session_state['test_started'] = False
 
 
 
 
 
 
144
 
145
+ if not st.session_state['test_started']:
146
+ st.title("Welcome to the Candidate Assessment Platform")
147
+ name, email, experience, technology, submit = layout.render_signup_form()
148
+ if name and email:
149
+ st.session_state['name'] = name
150
+ st.session_state['email'] = email
151
+ st.session_state['experience'] = experience
152
+ st.session_state['technology'] = technology
153
+ st.session_state['test_wip'] = True
154
+ if submit:
155
+ st.session_state['test_started'] = True
156
+ st.rerun()
157
+ layout.render_instructions()
158
+ else:
159
+ call(candidate_id)
160
+ else:
161
+ st.markdown("Invalid URL")
162
  if __name__ == "__main__":
163
  main()
data/candidates.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ id,name,email,experience,technology,test_time,score,status
2
+ b74cdb645ddc4ebab1eafd8ebf9b7afd,sj@gmail.com,sg@gmail.com,3,Python,2025-01-23 00:43:26,25.0,Test Completed
3
+ fb9bbcc6fabe4c838c1d629fabd9f82b,albert,albert@nsio.com,3,RoR,2025-01-23 00:44:21,75.0,Test Completed
4
+ 39ea39fc5c6a424cae00a674954f8b62,sumedha,sumedha@gmail.com,3,Data Engineering,2025-01-23 01:00:21,25.0,Test Completed
5
+ c73be32b003942bca7d8065b85f72e59,rutuja ,rpandule@gmail.com,3,React,2025-01-23 01:11:08,50.0,Test Completed
{questions β†’ data/questions}/ai/questions.csv RENAMED
File without changes
{questions β†’ data/questions}/common/questions.csv RENAMED
File without changes
{questions β†’ data/questions}/data engineering/questions.csv RENAMED
File without changes
{questions β†’ data/questions}/django/questions.csv RENAMED
File without changes
data/questions/java/questions.csv ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ What is the size of an int in Java?,2 bytes,4 bytes,8 bytes,16 bytes,4 bytes,low
3
+ Which keyword is used to create a class in Java?,class,Class,new,create,class,low
4
+ What is the default value of a boolean variable?,true,false,null,undefined,false,low
5
+ Which method is used to print output in Java?,println(),display(),output(),print(),println(),low
6
+ What does JVM stand for?,Java Virtual Machine,Java Virtual Model,Java Verified Machine,Java View Model,Java Virtual Machine,low
7
+ Which operator is used for comparison in Java?,=,==,!=,<>,==,low
8
+ What is the entry point of a Java program?,main(),start(),run(),execute(),main(),low
9
+ What is the extension of compiled Java files?,.java,.class,.exe,.javac,.class,low
10
+ Which package is imported by default in Java?,java.util,java.lang,java.io,java.net,java.lang,low
11
+ Which keyword is used to inherit a class in Java?,extend,extends,inherit,inherits,extends,low
12
+ What is used to handle exceptions in Java?,try-catch,if-else,for loop,while loop,try-catch,low
13
+ Which of these is a reserved keyword in Java?,void,main,static,return,void,low
14
+ What does the 'final' keyword do?,Creates a constant variable,Creates a variable,Creates a loop,Creates a method,Creates a constant variable,low
15
+ Which data type is used to store a sequence of characters?,int,char,String,double,String,low
16
+ Which method is used to convert a string to lowercase?,toLowerCase(),toLower(),convertLower(),makeLowerCase(),toLowerCase(),low
17
+ What is the parent class of all classes in Java?,String,Object,Class,BaseClass,Object,low
18
+ What is the default value of an int variable?,0,-1,null,undefined,0,low
19
+ Which loop is used to iterate a fixed number of times?,for,while,do-while,foreach,for,low
20
+ Which access modifier allows visibility within the same package?,public,protected,default,private,default,low
21
+ What is the output of '5 + 2 + \"3\"' in Java?,10,523,73,Error,73,medium
22
+ Which interface is implemented for multithreading in Java?,Runnable,Thread,Callable,MultiThread,Runnable,medium
23
+ How do you define a constant in Java?,const,final,static,define,final,medium
24
+ Which exception is thrown when a thread is waiting or sleeping?,InterruptedException,IOException,NullPointerException,RuntimeException,InterruptedException,medium
25
+ Which method is used to stop a thread?,stop(),terminate(),shutdown(),halt(),stop(),medium
26
+ How are elements stored in a TreeSet?,Insertion order,Sorted order,Random order,Reverse order,Sorted order,medium
27
+ Which class is used for buffered input in Java?,BufferedReader,InputStreamReader,Scanner,FileReader,BufferedReader,medium
28
+ How do you serialize an object in Java?,By using Serializable interface,By using Externalizable interface,By using ObjectOutputStream,All of the above,All of the above,medium
29
+ What is the purpose of 'super' keyword in Java?,Access parent class methods,Access parent class constructor,Access parent class variables,All of the above,All of the above,medium
30
+ What is the default priority of a thread?,5,1,10,0,5,medium
31
+ Which method is called when an object is garbage collected?,finalize(),dispose(),clear(),delete(),finalize(),medium
32
+ Which of these are checked exceptions?,IOException,NullPointerException,ArrayIndexOutOfBoundsException,ArithmeticException,IOException,medium
33
+ What is the return type of 'compareTo()' method?,int,boolean,String,void,int,medium
34
+ Which method is used to compare two strings ignoring case?,compareTo(),compareToIgnoreCase(),equals(),equalsIgnoreCase(),compareToIgnoreCase(),medium
35
+ What is the result of '10 << 2'?,20,40,30,10,40,medium
36
+ What happens when you divide an integer by zero?,ArithmeticException,NullPointerException,Infinity,NaN,ArithmeticException,medium
37
+ How do you create an unmodifiable collection?,Collections.unmodifiableCollection(),Collections.immutableCollection(),Collections.staticCollection(),Collections.readOnlyCollection(),Collections.unmodifiableCollection(),medium
38
+ Which collection allows null values?,ArrayList,HashMap,HashSet,All of the above,All of the above,medium
39
+ What is the time complexity of accessing an element in HashMap?,O(1),O(n),O(log n),O(n log n),O(1),medium
40
+ Which stream is used for reading binary data?,InputStream,BufferedInputStream,FileInputStream,All of the above,All of the above,medium
41
+ What is the result of 'Math.floor(-2.5)?',-3.0,-2.0,2.5,-2.5,-3.0,high
42
+ How can you make a method synchronized in Java?,Use the synchronized keyword,Use the lock() method,Use the thread-safe interface,Use the sync block,Use the synchronized keyword,high
43
+ What is the purpose of 'volatile' keyword?,Ensures visibility of changes across threads,Prevents thread execution,Marks a variable as constant,Prevents garbage collection,Ensures visibility of changes across threads,high
44
+ What is the difference between '==' and 'equals()'?,'==' checks reference equality, 'equals()' checks content equality,'==' checks content equality, 'equals()' checks reference equality,Both are the same,Depends on implementation,'==' checks reference equality, 'equals()' checks content equality,high
45
+ Which design pattern is used by Java's runtime class?,Singleton,Prototype,Factory,Adapter,Singleton,high
46
+ What happens if a thread is interrupted while sleeping?,Throws InterruptedException,Continues sleeping,Ignores interruption,Terminates immediately,Throws InterruptedException,high
47
+ Which Java feature prevents modification of an object's state?,Immutability,Encapsulation,Abstraction,Polymorphism,Immutability,high
48
+ What is the output of 'System.out.println(10 + 20 + \"30\");'?,30,1030,2030,Error,1030,high
49
+ What does 'strictfp' modifier do?,Restricts floating-point calculations,Enables faster floating-point operations,Makes floating-point consistent,None of the above,Restricts floating-point calculations,high
50
+ Which Java feature allows runtime method resolution?,Polymorphism,Abstraction,Encapsulation,Inheritance,Polymorphism,high
51
+ What is a marker interface?,Interface with no methods,Interface with default methods,Interface with a single method,Interface with static methods,Interface with no methods,high
52
+ What is the purpose of 'ClassLoader' in Java?,Loads classes at runtime,Compiles classes,Links classes,Stores class metadata,Loads classes at runtime,high
53
+ How can you avoid deadlocks in Java?,Avoid nested locks,Use try-finally for locks,Use a timeout for locks,All of the above,All of the above,high
54
+ What is the result of 'Integer.parseInt(\"10\") + Integer.valueOf(\"20\")'?,1020,30,10,Error,30,high
55
+ How can you make an object eligible for garbage collection?,Set its reference to null,Call System.gc(),Remove all references,All of the above,All of the above,high
56
+ What is the default encoding for Java strings?,UTF-8,UTF-16,ASCII,ISO-8859-1,UTF-16,high
57
+ Which thread state indicates it is eligible to run but not running?,RUNNABLE,BLOCKED,WAITING,TERMINATED,RUNNABLE,high
58
+ What is the role of 'transient' keyword?,Prevents serialization,Ensures serialization,Excludes field during serialization,Includes static fields,Excludes field during serialization,high
59
+ What is the result of '0.1 + 0.2' in Java?,0.3,0.30000000000000004,0.2,Error,0.30000000000000004,high
60
+ How does 'HashMap' handle hash collisions?,Separate chaining,Linear probing,Open addressing,Rehashing,Separate chaining,high
{questions β†’ data/questions}/python/questions.csv RENAMED
File without changes
data/questions/qa/questions.csv ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ What does QA stand for?,Quality Assurance,Quality Analysis,Question Answer,Quality Authentication,Quality Assurance,low
3
+ Which of the following is the primary goal of QA?,To ensure the product is defect-free,To ensure the product meets the customer's needs,To test the functionality,To ensure the product is delivered on time,To ensure the product is defect-free,low
4
+ Which is a non-functional testing type?,Unit Testing,Smoke Testing,Performance Testing,Regression Testing,Performance Testing,low
5
+ What is the purpose of a test case?,To document the testing process,To execute code,To define the testing environment,To validate specific functionality,To validate specific functionality,low
6
+ What is a test plan?,A detailed document describing the testing strategy,An automated test script,An outline of the project schedule,The log for all executed tests,A detailed document describing the testing strategy,low
7
+ Which type of testing is performed after the code is deployed to the production environment?,Regression Testing,Smoke Testing,Post-release Testing,Unit Testing,Post-release Testing,low
8
+ What does "defect density" measure?,The number of defects per unit size of the software,The size of defects,The number of test cases executed,The number of issues reported,The number of defects per unit size of the software,low
9
+ What is the role of a test case's precondition?,To specify the system's behavior,To describe the expected result,To define the system's state before execution,To specify the inputs required for testing,To define the system's state before execution,low
10
+ Which is the first step in the software testing process?,Test Planning,Test Execution,Test Design,Test Closure,Test Planning,low
11
+ What does UAT stand for?,User Acceptance Testing,Unit Acceptance Testing,User Action Testing,Universal Acceptance Testing,User Acceptance Testing,low
12
+ What is the goal of regression testing?,To check if new code changes affect existing functionality,To test new functionality only,To test the entire system,To check compatibility with previous versions,To check if new code changes affect existing functionality,low
13
+ What is black-box testing?,Testing without knowledge of the internal code,Testing with knowledge of the internal code,Testing the hardware components,Testing the UI components,Testing without knowledge of the internal code,low
14
+ What is a "bug" in software development?,A defect or flaw in the software,An enhancement to the software,A new feature of the software,A hardware issue,A defect or flaw in the software,low
15
+ What does "smoke testing" verify?,Basic functionality of the system,The performance of the system,The security of the system,The scalability of the system,Basic functionality of the system,low
16
+ What is the main objective of exploratory testing?,To find defects by exploring the application,To execute pre-designed test cases,To test a new feature,To automate test scripts,To find defects by exploring the application,low
17
+ What is the purpose of a bug report?,To provide feedback on the software's functionality,To document the status of testing,To report issues in the software for developers,To create new test cases,To report issues in the software for developers,low
18
+ What does a "test environment" refer to?,The physical or virtual setup where testing occurs,The software being tested,The team performing the tests,The testing tools used,The physical or virtual setup where testing occurs,low
19
+ What does "load testing" evaluate?,The performance of the system under heavy load,The functionality of the system,The security of the system,The usability of the system,The performance of the system under heavy load,medium
20
+ Which of the following is a non-functional requirement?,Security,Usability,Performance,All of the above,All of the above,medium
21
+ What is the primary focus of a QA engineer?,To ensure the quality of the software product,To write code for the application,To create test cases for the application,To design the software architecture,To ensure the quality of the software product,medium
22
+ What is the purpose of the "Test Execution" phase in the software testing life cycle?,To execute the test cases and record the results,To design the test cases,To prepare the test environment,To plan the test strategy,To execute the test cases and record the results,medium
23
+ What is "boundary value analysis"?,A technique used to identify boundary errors in software,The process of analyzing a product's value,The testing of software boundaries for performance,The analysis of user acceptance criteria,A technique used to identify boundary errors in software,medium
24
+ What is "test automation"?,Using automated tools to run tests,Running manual test cases,Testing the software without tools,Testing only the user interface,Using automated tools to run tests,medium
25
+ What is a "test scenario"?,A high-level description of what will be tested,The script for testing,The expected result of a test case,The input data for testing,A high-level description of what will be tested,medium
26
+ What is the purpose of the "defect triage" process?,To categorize and prioritize defects,To execute test cases,To automate tests,To fix defects,To categorize and prioritize defects,medium
27
+ Which type of testing involves testing the application's security?,Security Testing,Usability Testing,Performance Testing,Smoke Testing,Security Testing,medium
28
+ What does "test case traceability" refer to?,The ability to trace test cases back to requirements,The ability to trace defects back to the source,The ability to track the testing process,The ability to correlate test case results,The ability to trace test cases back to requirements,medium
29
+ What is the purpose of "load testing"?,To evaluate how the system behaves under peak conditions,To evaluate functionality under normal conditions,To check the system's response to data input,To evaluate system security,To evaluate how the system behaves under peak conditions,medium
30
+ What is the goal of "performance testing"?,To evaluate the speed and responsiveness of the application,To verify the functional correctness of the application,To check how well the software handles data storage,To test the application's security,To evaluate the speed and responsiveness of the application,medium
31
+ What is "stress testing"?,Testing the software under extreme conditions,Testing the software under normal conditions,Testing the software's performance,Testing the software's usability,Testing the software under extreme conditions,medium
32
+ Which testing method is used to evaluate the usability of an application?,Usability Testing,Security Testing,Stress Testing,Performance Testing,Usability Testing,medium
33
+ What does "usability testing" evaluate?,How easy and user-friendly the application is,The security of the application,The performance of the application,The scalability of the application,How easy and user-friendly the application is,medium
34
+ What does "alpha testing" refer to?,Testing performed by the development team,Testing performed by the end users,Testing performed after product release,Testing performed by QA teams,Testing performed by the development team,medium
35
+ What is the purpose of "regression testing"?,To verify that new changes don't negatively impact existing functionality,To test new features,To test the system's security,To evaluate the performance of the system,To verify that new changes don't negatively impact existing functionality,medium
36
+ What is the main goal of "acceptance testing"?,To ensure the software meets the business requirements,To evaluate performance,To test security vulnerabilities,To check the application for bugs,To ensure the software meets the business requirements,medium
37
+ What is the difference between "black-box" and "white-box" testing?,Black-box tests the software without knowledge of its internal code,White-box tests the software from an internal code perspective,Black-box tests the software from an internal code perspective,White-box tests the software without knowledge of its internal code,Black-box tests the software without knowledge of its internal code, high
38
+ What does "test coverage" mean?,The percentage of code that has been tested,The percentage of test cases executed,The percentage of defects found during testing,The percentage of requirements that have been met,The percentage of code that has been tested,high
39
+ What is "equivalence partitioning"?,A testing technique that divides input data into valid and invalid partitions,Testing multiple components together,Testing a system under different load conditions,The process of automating test cases,A testing technique that divides input data into valid and invalid partitions,high
40
+ What is the primary purpose of "alpha testing"?,To identify bugs before releasing the product to the end users,To check the user interface for issues,To test the system's security,To evaluate the product's market viability,To identify bugs before releasing the product to the end users,high
41
+ What is the main goal of "end-to-end testing"?,To test the complete functionality of the application from start to finish,To check the performance of the application,To test the database interaction,To test individual components,To test the complete functionality of the application from start to finish,high
42
+ What does "continuous integration testing" refer to?,Testing software as new code changes are integrated into the main codebase,Testing software after each release,Testing software only after bug fixes,Testing software under load,Testing software as new code changes are integrated into the main codebase,high
43
+ What is "security testing"?,Testing to identify vulnerabilities and threats in the application,Testing the functionality of the software,Testing for performance under load,Testing to identify UI issues,Testing to identify vulnerabilities and threats in the application,high
44
+ What is the purpose of "UI testing"?,To verify that the user interface is functioning as expected,To test the backend functionality,To verify system security,To evaluate performance,To verify that the user interface is functioning as expected,high
45
+ What is the purpose of "smoke testing"?,To quickly assess whether the build is stable enough for further testing,To test the full functionality of the system,To test the system's performance,To evaluate security vulnerabilities,To quickly assess whether the build is stable enough for further testing,high
46
+ What does "test automation" help with?,Faster and more reliable execution of repetitive tests,Manual testing of UI components,Testing the performance of the system,Evaluating the security of the system,Faster and more reliable execution of repetitive tests,high
data/questions/react/questions.csv ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ What is JSX in React?,JavaScript XML,JavaScript Extension,JavaScript Execution,JSON Extension,JavaScript XML,low
3
+ Which method is used to render a React component?,renderComponent(),render(),createElement(),renderReact(),render(),low
4
+ What is the default state of a React component?,null,undefined,false,empty object,empty object,low
5
+ Which hook is used for managing state in functional components?,useState(),useEffect(),useReducer(),useContext(),useState(),low
6
+ What is the purpose of `componentDidMount()` in React?,It is used to fetch data after the component is mounted,It initializes the state,It renders the component,It handles events,It is used to fetch data after the component is mounted,low
7
+ What is the purpose of `props` in React?,To pass data from parent to child components,To store component state,To handle events,To render JSX,To pass data from parent to child components,low
8
+ Which of the following is used to style React components?,CSS,JSX,JavaScript,HTML,CSS,low
9
+ What is the purpose of the `useEffect()` hook in React?,To manage side effects in functional components,To update the state,To define JSX,To render components,To manage side effects in functional components,low
10
+ What is the primary method for updating state in a React component?,setState(),useState(),updateState(),changeState(),setState(),low
11
+ How do you create a class component in React?,class Component extends React.Component,component Component extends React.Component,class Component extends BaseComponent,function Component(),class BaseComponent extends React.Component,class Component extends React.Component,low
12
+ Which of the following is the correct way to create a functional component?,function MyComponent(),const MyComponent = () => {},class MyComponent(),const MyComponent = function() {},const MyComponent = () => {},low
13
+ What does `map()` do in JavaScript?,It creates a new array from the result of calling a function on every element in an array,It sorts an array,It filters elements of an array,It merges two arrays,It creates a new array from the result of calling a function on every element in an array,low
14
+ What is the purpose of `state` in React?,To hold dynamic data for the component,To pass data between components,To render HTML,To call functions,To hold dynamic data for the component,low
15
+ What is the correct syntax for setting a default prop value in React?,MyComponent.defaultProps = { prop: value },MyComponent.propTypes = { prop: value },MyComponent.props = { prop: value },MyComponent.default = { prop: value },MyComponent.defaultProps = { prop: value },low
16
+ What is the correct way to add a key to a list of components in React?,key={index},id={index},ref={index},index={key},key={index},low
17
+ What is Redux?,A state management library for JavaScript,An HTTP request library,A React component library,A CSS framework,A state management library for JavaScript,low
18
+ In Redux, what does the store contain?,Actions,Reducers,State,Views,State,low
19
+ Which method in Redux is used to dispatch actions?,dispatch(),setState(),updateState(),callAction(),dispatch(),low
20
+ What is a reducer in Redux?,A function that handles actions and updates the state,An action that triggers state change,A function that initializes the store,An event listener, A function that handles actions and updates the state,low
21
+ Which function is used to create a Redux store?,createStore(),initializeStore(),newStore(),configureStore(),createStore(),low
22
+ What is the role of an action in Redux?,To describe what happened in the app,To update the state,To initialize the store,To store data,To describe what happened in the app,low
23
+ How do you connect Redux to a React component?,useState(),useEffect(),connect(),useReducer(),connect(),low
24
+ What does `useDispatch()` hook do in Redux?,It dispatches an action,It updates the state,It connects the component to Redux store,It subscribes to the store,It dispatches an action,low
25
+ What is the purpose of `useSelector()` in Redux?,To read state from the store,To update the state in the store,To dispatch an action,To connect the component to the Redux store,To read state from the store,low
26
+ What is the function of the `combineReducers()` method in Redux?,To combine multiple reducers into a single reducer,To merge multiple stores,To create multiple actions,To update state in multiple reducers,To combine multiple reducers into a single reducer,medium
27
+ What is the correct way to access an object’s property in JavaScript?,object.property,object->property,object[property],object:property,object.property,medium
28
+ What is the use of `super()` in JavaScript classes?,To call the parent class constructor,To access properties of the current class,To define a method,To define a variable,To call the parent class constructor,medium
29
+ What does the `this` keyword refer to in JavaScript?,The current object,The global object,The previous object,The parent object,The current object,medium
30
+ How do you bind a method to the current instance in a JavaScript class?,using `.bind()`,using `.call()`,using `.apply()`,using `.this()`,using `.bind()`,medium
31
+ How do you prevent an event from bubbling in JavaScript?,event.stop(),event.preventDefault(),event.stopPropagation(),event.cancel(),event.stopPropagation(),medium
32
+ What is the purpose of `componentWillUnmount()` in React?,It is called before a component is removed from the DOM,It updates the state,It is called after the component mounts,It is used to fetch data,It is called before a component is removed from the DOM,medium
33
+ What is `localStorage` in JavaScript?,A web storage mechanism to store data locally,An API to fetch data from a server,A function to store data in cookies,An array to hold data,A web storage mechanism to store data locally,medium
34
+ What does the `filter()` method do in JavaScript?,It creates a new array with elements that pass a test,It combines multiple arrays into one,It reverses the order of an array,It creates a new array from an existing array,It creates a new array with elements that pass a test,medium
35
+ What is the correct syntax to import a named export in JavaScript?,import { name } from 'module',import name from 'module',import { name } from module,import 'module',import { name } from 'module',medium
36
+ What is a promise in JavaScript?,An object representing the eventual completion or failure of an asynchronous operation,An object that handles events,An object to store functions,An object for regular expressions,An object representing the eventual completion or failure of an asynchronous operation,medium
37
+ How do you set a value in the sessionStorage in JavaScript?,sessionStorage.setItem('key', 'value'),sessionStorage.set('key', 'value'),sessionStorage.save('key', 'value'),sessionStorage.put('key', 'value'),sessionStorage.setItem('key', 'value'),medium
38
+ Which of the following is used to create a responsive design in CSS?,Media Queries,Positioning,Flexbox,Grid,Media Queries,medium
39
+ What is the purpose of the `z-index` property in CSS?,To define the stacking order of elements,To define the width of elements,To position elements,To define the height of elements,To define the stacking order of elements,medium
40
+ What is the default display property of a `div` element in CSS?,block,inline,flex,grid,block,medium
41
+ How do you center a div element using Flexbox in CSS?,display: flex; justify-content: center; align-items: center;,display: flex; center: true;,display: center; justify-content: flex; align-items: center;,center: true; display: flex;,display: flex; justify-content: center; align-items: center;,medium
42
+ What does the `float` property do in CSS?,It floats an element to the left or right of its container,It centers an element within its container,It defines the size of the container,It adds margins to an element,It floats an element to the left or right of its container,medium
43
+ Which property is used to change the background color of an element in CSS?,background-color,color,background,image,background-color,medium
44
+ What does the `position: absolute` property do in CSS?,Positions an element relative to its nearest positioned ancestor,Positions an element relative to the viewport,Positions an element relative to its parent,Positions an element at a fixed position,Positions an element relative to its nearest positioned ancestor,medium
45
+ How do you hide an element in CSS?,display: none;,visibility: hidden;,opacity: 0;,display: hidden;,display: none;,medium
46
+ How do you make a CSS element responsive?,Use media queries,Use fixed widths,Use absolute positioning,Use float properties,Use media queries,medium
47
+ What is the difference between `inline` and `block` elements in CSS?,Inline elements do not start on a new line,Block elements take up the full width of their parent,Inline elements take up the full width,Block elements start on a new line,Inline elements do not start on a new line,medium
48
+ What is the correct way to link a CSS file to an HTML document?,<link rel="stylesheet" href="styles.css">,<link src="styles.css" />,<css src="styles.css" />,<style src="styles.css" />,<link rel="stylesheet" href="styles.css">,medium
49
+ What is the purpose of the `@media` rule in CSS?,To apply styles based on specific conditions (e.g., screen size),To apply animations to elements,To create keyframe animations,To group styles together,To apply styles based on specific conditions (e.g., screen size),high
50
+ How do you apply multiple classes to an element in HTML?,<div class="class1 class2">,<div class="class1,class2">,<div class="class1+class2">,<div class="class1|class2">,<div class="class1 class2">,high
51
+ What does `grid-template-columns` do in CSS?,Defines the column structure in a CSS Grid container,Defines the rows in a Grid container,Defines the gap between columns,Defines the position of elements,Defines the column structure in a CSS Grid container,high
52
+ What is the `flex-wrap` property used for in CSS?,It specifies whether the flex items should wrap onto multiple lines,It defines the direction of the flex items,It sets the alignment of flex items,It sets the position of flex items,It specifies whether the flex items should wrap onto multiple lines,high
53
+ How do you make a CSS Grid container?,display: grid;,display: flex;,display: block;,grid: container;,display: grid;,high
54
+ What does `opacity: 0.5` do in CSS?,Makes an element 50% transparent,Sets the element's transparency to 50%,Makes the element half transparent,Makes the element fully transparent,Makes an element 50% transparent,high
55
+ How do you add a shadow effect to an element in CSS?,box-shadow,shadow-effect,element-shadow,outline-shadow,box-shadow,high
56
+ How do you align items to the center of a flex container?,justify-content: center; align-items: center;,align-center: true;,display: center; justify-items: center;,flex-align: center;,justify-content: center; align-items: center;,high
57
+ What does `justify-content: space-between` do in Flexbox?,Distributes the items evenly with space between,Aligns items to the center,Aligns items to the start,Aligns items to the end,Distributes the items evenly with space between,high
58
+ How do you use CSS variables?,--variable-name: value;,var(--variable-name),var(--variable-name): value;,set --variable-name: value;,--variable-name: value;,high
59
+ How do you implement a responsive font size in CSS?,font-size: calc(1vw + 1em);,font-size: 12px;,font-size: 2rem;,font-size: 100%;,font-size: calc(1vw + 1em);,high
60
+ How do you create a CSS animation?,@keyframes and animation properties,@animate and keyframes,@move and keyframes,@animation and animate,@keyframes and animation properties,high
data/questions/ror/questions.csv ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ What does MVC stand for in Ruby on Rails?,Model View Controller,Model View Content,Master View Controller,Main Value Controller,Model View Controller,low
3
+ Which command creates a new Rails application?,rails new,rails generate,rails create,rails init,rails new,low
4
+ What is the default database used in a Rails application?,SQLite,PostgreSQL,MySQL,Oracle,SQLite,low
5
+ Which file defines the routes in a Rails application?,routes.rb,application.rb,config.rb,route.rb,routes.rb,low
6
+ Which method is used to define a route in Rails?,route(),resources(),map(),get(),resources(),low
7
+ What is ActiveRecord in Rails?,ORM framework,HTML rendering engine,API client,view helper,ORM framework,low
8
+ How do you create a new migration in Rails?,rails generate migration,rails generate model,rails create migration,rails make migration,rails generate migration,low
9
+ Which file contains the database configuration in Rails?,database.yml,db_config.rb,config.rb,db.yml,database.yml,low
10
+ Which command runs all the migrations in Rails?,rails db:migrate,rails db:setup,rails migrate,rails db:run,rails db:migrate,low
11
+ Which method is used to render a view in Rails?,render(),render_view(),show(),view(),render(),low
12
+ How do you define a model in Rails?,class Model < ActiveRecord::Base,model Model < ApplicationRecord,class Model < ApplicationRecord,model class Model,class Model < ActiveModel::Base,class Model < ActiveRecord::Base,low
13
+ What is the primary purpose of the `rails console`?,To test Rails commands,To interact with the Rails application in the terminal,To view Rails logs,To run Rails migrations,To interact with the Rails application in the terminal,low
14
+ Which of the following is used to define a route for a RESTful resource?,resources :model,resource :model,route :model,get :model,resources :model,low
15
+ What does `rails server` start?,A test environment,A development server,The production server,The database,A development server,low
16
+ What is the purpose of `rails db:seed`?,To generate the schema,To load seed data into the database,To run all migrations,To initialize the application,To load seed data into the database,low
17
+ What is the default view engine used in Rails?,ERB,HAML,SLIM,HTML,ERB,low
18
+ Which of the following is not a Rails helper?,link_to,render,form_for,find,find,low
19
+ What is the purpose of the `before_action` callback?,To execute code before a controller action,To execute code after a controller action,To define a default value,To fetch data before rendering a view,To execute code before a controller action,low
20
+ How do you create a new controller in Rails?,rails generate controller,rails generate model,rails create controller,rails create controller,rails generate controller,low
21
+ Which method is used to generate a new resource in Rails?,rails generate scaffold,rails generate resource,rails create resource,rails generate model,rails generate scaffold,low
22
+ What is the purpose of the `belongs_to` association in Rails?,To set up a one-to-one relationship,To set up a one-to-many relationship,To set up a many-to-many relationship,To create a nested resource,To set up a one-to-one relationship,low
23
+ How do you add a new column to an existing table in Rails?,rails generate migration,rails db:migrate,rails db:add_column,rails generate model,rails generate migration,medium
24
+ Which of the following is the correct way to render a partial in Rails?,render 'partial',render partial(),render 'partial.html.erb',render 'shared/partial',render 'partial',medium
25
+ How do you store session data in Rails?,In a database,in cookies,in a file,in memory,in a database,medium
26
+ What is the purpose of the `has_many` association in Rails?,To set up a one-to-one relationship,To set up a one-to-many relationship,To set up a many-to-many relationship,To create a nested resource,To set up a one-to-many relationship,medium
27
+ Which of the following is used to test models in Rails?,RSpec,FactoryBot,Cucumber,Test::Unit,RSpec,medium
28
+ What does the `strong_parameters` feature do in Rails?,Prevents mass assignment vulnerabilities,Encrypts parameters,Validates input parameters,Filters session data,Prevents mass assignment vulnerabilities,medium
29
+ How do you validate the presence of a field in Rails?,validates :field,validates_presence_of :field,validates_field :field,validates_presence :field,validates_presence_of :field,medium
30
+ Which file stores the database schema in Rails?,schema.rb,config.rb,migration.rb,db_config.rb,schema.rb,medium
31
+ What method is used to delete a record from the database in Rails?,destroy(),delete(),remove(),destroy_all(),destroy(),medium
32
+ What is the purpose of `flash` in Rails?,To store temporary messages,To store session data,To handle errors,To render partials,To store temporary messages,medium
33
+ What is the correct way to create a new migration for adding a column to a table?,rails generate migration AddColumnToTable,column:type,rails generate migration AddColumnToTable,column:type,rails create migration AddColumnToTable,column:type,rails create migration AddColumn,column:type,rails generate migration AddColumnToTable,column:type,medium
34
+ Which of the following is used to render an HTML form in Rails?,form_for,form_tag,render_form,form,form_for,medium
35
+ What is the use of `active_record` in Rails?,It connects models to the database,It handles routing,It handles the session data,It renders views,It connects models to the database,medium
36
+ How do you include JavaScript and CSS files in Rails?,Using the asset pipeline,Using a CDN,Including in the layout file,Using JavaScript include tags,Using the asset pipeline,medium
37
+ How do you define a scope in a Rails model?,scope :name,scope :name => ,scope :name do ,scope do,scope :name,medium
38
+ What is the main benefit of using Rails' built-in authentication?,Ease of use,Security,Flexibility,Customization,Security,medium
39
+ Which of these is used to send email in Rails?,ActionMailer,Mailer,Emailer,ActionView,ActionMailer,medium
40
+ What is the purpose of `rails db:reset`?,To reset the database schema,To run migrations,To drop and recreate the database,To seed the database,To drop and recreate the database,medium
41
+ How do you create a polymorphic association in Rails?,use `polymorphic: true` in the model,create a join table,add a foreign key,create a has_many relationship,use `polymorphic: true` in the model,high
42
+ What is the purpose of the `rails test` command?,Run all tests,Run unit tests,Run only model tests,Run functional tests,Run all tests,high
43
+ How do you create a database index in Rails?,add_index,create_index,create_index_in,migration_index,add_index,high
44
+ What is the correct way to create a database constraint in Rails?,use `add_foreign_key`,use `add_constraint`,use `validates_uniqueness_of`,use `add_check_constraint`,use `add_foreign_key`,high
45
+ How do you implement background jobs in Rails?,Sidekiq,ActiveJob,Resque,DelayedJob,ActiveJob,high
46
+ What is the purpose of `rails assets:precompile`?,Prepares assets for production,Deletes unused assets,Generates a sitemap,Prepares assets for development,Prepares assets for production,high
47
+ How do you add a unique constraint to a column in Rails?,validates_uniqueness_of,add_index with unique:true,add_constraint,validates_uniqueness,add_index with unique:true,high
48
+ Which Rails feature allows easy database querying?,ActiveRecord,ActiveJob,ActionCable,ActionMailer,ActiveRecord,high
49
+ What is the default Rails logger?,Logger,ActiveLogger,Log4r,ConsoleLogger,Logger,high
50
+ How do you configure Rails to use a different database in production?,Change the `database.yml` file,Change `config/database.rb`,Set an environment variable,Use a configuration initializer,Change the `database.yml` file,high
51
+ What is the purpose of `rails generate scaffold`?,Generates full resource code,Generates only a model,Generates only a controller,Generates only a migration,Generates full resource code,high
52
+ What is the main advantage of using `ActiveStorage` in Rails?,Uploading files easily,Sending email,Handling session data,Managing forms,Uploading files easily,high
53
+ How do you define a nested resource in Rails?,resources :parent do resources :child,end,resources :parent/child,resource :child,resources :parent/child,end,resources :parent do resources :child,end,high
54
+ How do you define a default value for a model attribute in Rails?,Use `default` in the database migration,Use `default` in the model,Use `default_value` method,Use `default_value` in the migration,Use `default` in the database migration,high
55
+ How do you handle file uploads in Rails?,ActiveStorage,FileUpload,CarrierWave,ActionMail,ActiveStorage,high
56
+ What does the `has_secure_password` method do in Rails?,Encrypts and authenticates passwords,Encrypts passwords only,Authenticates users,Generates a password hash,Encrypts and authenticates passwords,high
57
+ How do you configure Rails to use a different caching system?,Edit `config/environments/production.rb`,Edit `config/database.yml`,Edit `config/caching.rb`,Edit `config/initializers/cache.rb`,Edit `config/environments/production.rb`,high
questions.csv ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,option1,option2,option3,option4,answer,difficulty
2
+ What is Ruby on Rails?,A web application framework,A database management system,A programming language,A web server,A web application framework,low
3
+ Which command is used to start a new Rails project?,rails new,rails generate,rails start,rails setup,rails new,low
4
+ What is the purpose of the `Gemfile` in a Rails project?,To list project dependencies,To store database configurations,To manage migrations,To define routes,To list project dependencies,medium
5
+ What is Active Record in Rails?,A module for managing CSS files,An ORM for database interactions,A JavaScript framework,A library for API creation,An ORM for database interactions,medium
6
+ How do you create a migration in Rails?,rails generate migration,rails create migration,rails new migration,rails db migration,rails generate migration,medium
7
+ Which directory in a Rails project contains controller files?,app/controllers,app/models,app/views,config/,app/controllers,low
8
+ What is the primary use of `routes.rb` in a Rails application?,To define the application's routes,To manage database migrations,To configure environment settings,To define helper methods,To define the application's routes,low
9
+ Which of the following is NOT a Rails environment?,production,testing,development,staging,testing,medium
10
+ What does the `rake db:migrate` command do?,Runs pending migrations,Deletes old migrations,Seeds the database,Clears the database cache,Runs pending migrations,medium
11
+ How do you roll back the last migration in Rails?,rake db:rollback,rake db:reverse,rake db:down,rake db:undo,rake db:rollback,medium
12
+ What does the `before_action` callback do in Rails?,Executes code before a controller action,Executes code after a controller action,Executes code during a migration,Executes code during deployment,Executes code before a controller action,medium
13
+ Which of the following is used to render a view in Rails?,render,display,show,view,render,low
14
+ How do you define a one-to-many association in a Rails model?,has_many,has_one,belongs_to,has_and_belongs_to_many,has_many,medium
15
+ What does the `flash` object in Rails do?,Stores temporary messages,Handles session data,Manages cookies,Configures routing,Stores temporary messages,medium
16
+ Which command is used to start the Rails server?,rails server,rails start,rails run,rails execute,rails server,low
17
+ What is the default database for Rails?,SQLite,PostgreSQL,MySQL,Oracle,SQLite,low
18
+ How do you create a new controller in Rails?,rails generate controller,rails new controller,rails create controller,rails add controller,rails generate controller,medium
19
+ What is the purpose of the `schema.rb` file in Rails?,Describes the database schema,Stores routing information,Configures application settings,Manages testing files,Describes the database schema,medium
20
+ Which helper method is used to generate a link in Rails views?,link_to,url_for,path_to,link_for,link_to,low
21
+ How do you add a new column to a table in Rails?,rails generate migration AddColumnName,rails db:add_column,rails table:add_column,rails migration add_column,rails generate migration AddColumnName,high