0% found this document useful (0 votes)
6 views9 pages

Case Study

The document consists of multiple-choice and true/false questions regarding the 8 Queens Problem and Genetic Algorithms (GAs). It covers topics such as the objective of the 8 Queens Problem, fitness evaluation, selection processes, crossover and mutation, and the overall functioning of GAs. The answers provided clarify key concepts and mechanisms involved in solving the 8 Queens Problem using GAs.

Uploaded by

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

Case Study

The document consists of multiple-choice and true/false questions regarding the 8 Queens Problem and Genetic Algorithms (GAs). It covers topics such as the objective of the 8 Queens Problem, fitness evaluation, selection processes, crossover and mutation, and the overall functioning of GAs. The answers provided clarify key concepts and mechanisms involved in solving the 8 Queens Problem using GAs.

Uploaded by

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

Multiple-Choice Questions (MCQs)

1. What is the primary objective of the 8 Queens Problem?


a) To place 8 queens on a chessboard without them threatening each other
b) To find the fastest way to place all queens
c) To minimize the chessboard size
d) To maximize the number of queens on the board

Answer: a) To place 8 queens on a chessboard without them threatening each other

2. How is a single solution represented in the 8 Queens problem?


a) As a binary string
b) As an 8x8 grid
c) As an array of 8 values
d) As a single fitness value

Answer: c) As an array of 8 values

3. What does the fitness function evaluate in the 8 Queens Problem?


a) The total number of queens on the board
b) The total penalty for all queens threatening each other
c) The number of rows used by queens
d) The speed of solution generation

Answer: b) The total penalty for all queens threatening each other

4. What does a fitness value of 0 indicate in the 8 Queens Problem?


a) A partially correct solution
b) An optimal solution
c) A solution with high penalties
d) No solution

Answer: b) An optimal solution

5. What is the penalty for a single queen?


a) The number of other queens it can see
b) The row difference between queens
c) The column difference between queens
d) The fitness value of the solution

Answer: a) The number of other queens it can see

6. How is the initial population created in GAs?


a) By randomly generating N solutions
b) By solving the problem manually
c) By using a deterministic algorithm
d) By selecting the best solutions

Answer: a) By randomly generating N solutions

7. What is the purpose of selection in GAs?


a) To evaluate fitness
b) To mutate the solutions
c) To choose parents for reproduction
d) To replace the initial population
Answer: c) To choose parents for reproduction

8. What is added to negative fitness values during selection to avoid zero probabilities?
a) A random number
b) The most negative value + 1
c) The maximum fitness value
d) A fixed threshold

Answer: b) The most negative value + 1

9. Which operator combines the genetic material of two parents?


a) Selection
b) Mutation
c) Crossover
d) Fitness evaluation

Answer: c) Crossover

10. What is the typical probability of crossover in GAs?


a) 10%
b) 50%
c) 70%
d) 90%

Answer: c) 70%

11. What happens if a random number exceeds the crossover probability?


a) Crossover occurs
b) Mutation occurs
c) Parents are copied without modification
d) Fitness evaluation is repeated

Answer: c) Parents are copied without modification

12. What does mutation introduce in GAs?


a) Diversity
b) Selection
c) Crossover points
d) Penalty

Answer: a) Diversity

13. What is a typical mutation probability?


a) 1%
b) 10%
c) 50%
d) 90%

Answer: a) 1%

14. Which function is used to randomly select parents in Python?


a) np.random.rand()
b) np.random.choice()
c) np.random.select()
d) np.random.sample()
Answer: b) np.random.choice()

15. What is the stopping condition for the 8 Queens problem?


a) After a fixed number of generations
b) When fitness = 0 or a maximum generation is reached
c) When all queens are on the board
d) When no more mutations occur

Answer: b) When fitness = 0 or a maximum generation is reached

16. What is the total penalty for a solution where no queens threaten each other?
a) 0
b) 8
c) 16
d) -8

Answer: a) 0

17. Which algorithm calculates the total penalty for a solution?


a) Fitness Evaluation Algorithm
b) Selection Algorithm
c) Mutation Algorithm
d) Initialization Algorithm

Answer: a) Fitness Evaluation Algorithm

18. What is the relationship between fitness and penalty?


a) Fitness is the negative of the penalty
b) Fitness is the square of the penalty
c) Fitness and penalty are the same
d) Fitness is independent of the penalty

Answer: a) Fitness is the negative of the penalty

19. What does the crossover point determine?


a) Where two parents are combined
b) The mutation rate
c) The fitness of a solution
d) The number of generations

Answer: a) Where two parents are combined

20. How are selected parents organized for crossover?


a) Randomly
b) Based on fitness
c) By alternating rows and columns
d) In pairs

Answer: d) In pairs

True/False Questions

21. The 8 Queens Problem requires that no two queens threaten each other.
True
22. Fitness values are always positive in GAs.
False

23. Selection in GAs is performed without replacement.


False

24. Higher fitness values indicate worse solutions in GAs.


False

25. Mutation introduces diversity into the population.


True

26. The crossover probability determines how often mutation occurs.


False

27. In the 8 Queens Problem, fitness is maximized when the penalty is minimized.
True

28. Random selection of parents is independent of fitness scores.


False

29. Negative fitness values are converted to probabilities by adding a constant.


True

30. The crossover operator mimics biological reproduction.


True

31. Mutation probability is typically higher than crossover probability.


False

32. Fitness evaluation occurs before selection.


True

33. The algorithm stops when the maximum number of generations is reached.
True

34. The penalty of a solution is calculated by summing the penalties for all queens.
True

35. Crossover is always performed on selected parents.


False

36. The fitness function determines which individuals are most likely to survive.
True

37. Mutation can occur multiple times within the same individual.
True

38. GAs guarantee finding the global optimum.


False

39. The 8 Queens Problem can be solved by a single generation in some cases.
True

40. Random initialization of the population ensures diverse starting solutions.


True
41. The probability of selecting a parent depends on its fitness value.
True

42. Mutation always improves the fitness of a solution.


False

43. Crossover combines genetic information from two parents.


True

44. In GAs, solutions with lower fitness have a higher chance of selection.
False

45. A population of size 1 is sufficient for a GA to work effectively.


False

46. Fitness evaluation can be skipped for parents during selection.


False

47. The 8 Queens Problem requires exactly 8 rows and 8 columns for the board.
True

48. A higher crossover probability leads to more diverse offspring.


True

49. Penalty values are always non-negative.


False

50. Optimal solutions in GAs have a fitness value of 0 in the 8 Queens Problem.
True

Multiple-Choice Questions

21. What does the fitness function aim to achieve in the 8 Queens Problem?
a) Maximize the penalty
b) Minimize the penalty
c) Randomize queen positions
d) Ensure all queens are in the same row

Answer: b) Minimize the penalty

22. What happens when the penalty for a solution is high?


a) The fitness is high
b) The fitness is low
c) The solution is optimal
d) Mutation probability increases

Answer: b) The fitness is low

23. Which value of fitness indicates an optimal solution in the 8 Queens Problem?
a) -1
b) 0
c) 8
d) 64

Answer: b) 0
24. What is the role of probabilities in the selection process?
a) To evaluate penalties
b) To determine mutation rate
c) To ensure fitter solutions are more likely to be selected
d) To decide the crossover point

Answer: c) To ensure fitter solutions are more likely to be selected

25. Why is the np.random.choice() function used in the selection phase?


a) To initialize the population
b) To randomly select parents based on fitness probabilities
c) To calculate fitness values
d) To determine the crossover rate

Answer: b) To randomly select parents based on fitness probabilities

26. What does "elitism" mean in the context of GAs?


a) Mutating all individuals
b) Ensuring the best solutions are retained in the next generation
c) Generating random solutions
d) Selecting parents based on age

Answer: b) Ensuring the best solutions are retained in the next generation

27. What is a key disadvantage of using a high mutation rate?


a) The population becomes stagnant
b) The algorithm takes longer to converge
c) Fitness values are difficult to calculate
d) The crossover probability decreases

Answer: b) The algorithm takes longer to converge

28. How many parents are typically needed for a single crossover?
a) 1
b) 2
c) 3
d) 4

Answer: b) 2

29. Which of the following is NOT a step in the Genetic Algorithm process?
a) Initialization
b) Fitness calculation
c) Backpropagation
d) Mutation

Answer: c) Backpropagation

30. How does the GA handle negative fitness values during selection?
a) It ignores them
b) It multiplies them by -1
c) It adds a constant to make them positive
d) It uses their absolute values

Answer: c) It adds a constant to make them positive


31. What does the crossover point determine?
a) Where mutation begins
b) The columns for the queens
c) The split between two parents to create offspring
d) The fitness value of the parents

Answer: c) The split between two parents to create offspring

32. Which of the following does mutation NOT do?


a) Introduce randomness
b) Prevent premature convergence
c) Ensure diversity
d) Replace all solutions in the population

Answer: d) Replace all solutions in the population

33. What is the output of the calc_fitness() function in the 8 Queens Problem?
a) A list of penalties for each queen
b) The optimal solution
c) Fitness values for all solutions in the population
d) The next generation population

Answer: c) Fitness values for all solutions in the population

34. What happens if the crossover probability (Pc) is set to 0?


a) All parents are copied without modification
b) No solutions are selected for reproduction
c) Mutation occurs instead of crossover
d) The algorithm stops execution

Answer: a) All parents are copied without modification

35. What is the default structure for a population in the 8 Queens Problem?
a) A single 8x8 matrix
b) An Nx8 array where N is the population size
c) A binary string for each solution
d) A list of fitness values

Answer: b) An Nx8 array where N is the population size

36. Which algorithm step ensures exploration of new areas in the solution space?
a) Fitness calculation
b) Crossover
c) Mutation
d) Selection

Answer: c) Mutation

37. How does GA avoid convergence to a local optimum?


a) By using multiple crossover points
b) By increasing fitness values
c) Through mutation and maintaining diversity
d) By reducing the population size

Answer: c) Through mutation and maintaining diversity


38. Which of these best describes the GA search process?
a) Deterministic
b) Heuristic
c) Exhaustive
d) Linear

Answer: b) Heuristic

39. Why is a random number used in the crossover process?


a) To determine if crossover occurs based on probability
b) To initialize the population
c) To calculate fitness values
d) To decide mutation rate

Answer: a) To determine if crossover occurs based on probability

40. What happens during the mutation process?


a) Two parents are combined to create offspring
b) A single value in a solution is randomly modified
c) Fitness values are recalculated
d) The population size is increased

Answer: b) A single value in a solution is randomly modified

41. What is the main goal of GAs in optimization problems?


a) Minimize runtime
b) Find the global or near-global optimum solution
c) Maximize population diversity
d) Generate infinite solutions

Answer: b) Find the global or near-global optimum solution

42. What does the crossover_mutation() function do in the 8 Queens implementation?


a) Replaces the initial population with random solutions
b) Combines crossover and mutation to produce a new population
c) Calculates fitness values for all solutions
d) Selects the optimal solution directly

Answer: b) Combines crossover and mutation to produce a new population

43. What is the primary advantage of using GAs for the 8 Queens Problem?
a) It guarantees the global optimum
b) It is faster than all other methods
c) It efficiently explores large solution spaces
d) It requires no coding

Answer: c) It efficiently explores large solution spaces

44. What is the penalty if a queen threatens no other queen?


a) -1
b) 0
c) 1
d) 8

Answer: b) 0
45. Why should the population size (N) in GAs be even?
a) To simplify mutation
b) To ensure pairs of parents for crossover
c) To avoid negative fitness values
d) To minimize runtime

Answer: b) To ensure pairs of parents for crossover

46. What is the maximum penalty a single queen can have?


a) 8
b) 7
c) 6
d) 5

Answer: b) 7

47. What kind of solutions does GA work best with?


a) Linear solutions
b) Solutions with a small search space
c) Large, complex, and multi-dimensional solutions
d) Predefined optimal solutions

Answer: c) Large, complex, and multi-dimensional solutions

48. What is a critical feature of crossover probability (Pc)?


a) It controls the mutation rate
b) It determines how often solutions are replaced
c) It defines the likelihood of combining parents
d) It calculates fitness values

Answer: c) It defines the likelihood of combining parents

49. What happens when a fitness value is -10, and the minimum fitness value in the population is -18?
a) The fitness is normalized to 10
b) It is converted to a positive value by adding 19
c) The fitness is ignored
d) The solution is removed from the population

Answer: b) It is converted to a positive value by adding 19

50. How does GA handle individuals with high fitness values?


a) They are penalized to maintain balance
b) They are more likely to be selected as parents
c) They are eliminated to introduce diversity
d) They are directly mutated

Answer: b) They are more likely to be selected as parents

You might also like