You are on page 1of 12

UNIVERSITY EXAMINATIONS: 2022/2023

EXAMINATION FOR THE DEGREES OF BACHELOR OF SCIENCE IN


APPLIED COMPUTING/ BACHELOR IN SOFTWARE DEVELOPMENT
BAC 3102/ BSD 3102: ARTIFICIAL INTELLIGENCE PROGRAMMING
FULL TIME/ PART TIME
ORDINARY EXAMINATION
DATE: DECEMBER, 2022 TIME: 2 HOURS

INSTRUCTIONS: Question ONE is COMPULSORY, Choose TWO Other Questions

QUESTION ONE (20 MARKS) COMPULSORY

a) As we know, AI pursues creating machines as intelligent as human beings. There are


numerous reasons for us to study AI Programming. State any four. [4 marks]

I. AI programming helps automate repetitive tasks, leading to increased efficiency and


productivity. This is particularly valuable in industries where manual labor can be replaced
or augmented by intelligent systems.

II. To create intelligent machines that can help us solve complex problems. AI has the
potential to revolutionize many industries and aspects of our lives, from healthcare to
transportation to customer service. By studying AI programming, we can develop the skills
and knowledge needed to build these intelligent machines.

III. To gain a better understanding of the human mind. AI research has helped us to better
understand how humans learn, reason, and make decisions. This knowledge can be used to
improve our own cognitive abilities and to develop new educational and therapeutic tools.

IV. To create new and innovative applications. AI is already being used to develop a wide
range of new applications, such as self-driving cars, facial recognition software, and
medical diagnostic tools. By studying AI programming, we can learn how to develop our
own innovative AI applications.

V. To stay ahead of the curve in the job market. AI is one of the most in-demand skills in the
current job market. By studying AI programming, we can make ourselves more marketable
to potential employers.

VI. Problem-solving: AI programming helps in solving complex problems that require logical
reasoning and decision-making.

VII. Data Analysis: AI can handle large amounts of data and extract meaningful insights from
it.

VIII. Innovation: Studying AI programming can lead to the development of innovative


applications and technologies.

b) State any two dominant applications of AI [2 Marks]


c) As described by Howard Gardner, an American developmental psychologist, Intelligence
comes in multifold. Describe any three intelligences that makes a machine or a system
artificially intelligent [6 marks]
d) Describe the relevance of an agent in an artificial environment stating at least three types of
agents in AI environment. [6 marks]
Reactive agents: These agents act based on their current state and the environment they
perceive.
Model-based agents: These agents maintain a model of the environment and use it to plan
their actions.
Goal-based agents: These agents have a set of goals and they act to achieve those goals.

e) Differentiate between programming with AI and Programing without AI [2 Marks]


Programming with AI Involves creating systems that can learn from data, adapt to new
information, and make decisions or predictions. AI programming often employs machine
learning techniques to enable systems to improve their performance over time.

Programming without AI involves creating systems with fixed, rule-based logic. These
systems do not have the ability to learn or adapt on their own and operate based on
predefined instructions.

QUESTION TW0 (15 MARKS)


a) Differentiate between Natural Language Generation and Natural Language Understanding
[2 marks]
Natural language understanding is a subset of natural language processing, which uses syntactic and
semantic analysis of text and speech to determine the meaning of human language. It focuses on machine
reading comprehension through grammar and context, enabling it to determine the intended meaning of a
sentence. For example, an NLU system could be used to extract the key information from a customer service
ticket, or to understand the intent of a user's search query.

Natural language generation (NLG) focuses on text generation, or the construction of text in
English or other languages, by a machine and based on a given dataset.For example, an NLG system
could be used to generate a news article from a database of news stories, or to generate a product
description from a database of product information.

b) Describe three types of human language ambiguity in Natural Language Processing


[6 Marks]

Essentially refers to sentences that have multiple alternative interpretations.

Lexical Ambiguity: This type of ambiguity represents words that can have multiple assertions. For
instance, in English, the word “back” can be a noun ( back stage), an adjective (back door) or an
adverb (back away).

Syntactic Ambiguity: This type of ambiguity represents sentences that can be parsed in multiple
syntactical forms. Take the following sentence: “ I heard his cell phone rin in my office”. The
prepositional phrase “in my office” can be parsed in a way that modifies the noun or in another way
that modifies the verb.

Semantic Ambiguity: This type of ambiguity is typically related to the interpretation of a sentence.
For instance, the previous sentence used in the previous point can be interpreted as if I was
physically present in the office or as if the cell phone was in the office.

The process of handling ambiguity is called disambiguation .

c) Discuss two business tasks where Sentiment analysis can be applied [4 Marks]
Customer Feedback Analysis: Sentiment analysis can be used to analyze customer
feedback and reviews. This can help businesses understand how their products or services
are perceived by their customers. It can identify positive, negative, and neutral sentiments,
and provide insights into specific issues that customers might be facing.
Brand Monitoring: Sentiment analysis can also be used for brand monitoring on social
media platforms. It can help businesses track public opinion about their brand and their
competitors. This can provide valuable insights into market trends and can help businesses
strategize their marketing efforts.

d) Describe three text analytics modeling techniques [3 Marks]


Rule-based sentiment analysis: This approach uses a set of predefined rules to identify
sentiment in text. For example, a rule-based sentiment analyzer might identify the words
"good" and "bad" as positive and negative sentiment indicators, respectively.
Statistical sentiment analysis: This approach uses statistical methods to identify sentiment
in text. For example, a statistical sentiment analyzer might train on a dataset of labeled
sentiment data to learn the associations between certain words and phrases and positive and
negative sentiment.
Deep learning sentiment analysis: This approach uses deep learning models to identify
sentiment in text. Deep learning models are trained on large datasets of labeled sentiment
data and can learn complex relationships between words and phrases and sentiment.
QUESTION THREE (15 MARKS)
a) Explain the logic behind targeted marketing. How can Machine Learning help with this?
[5 Marks]
Targeted marketing is the process of identifying and targeting specific customer segments with relevant
marketing messages. It is a more effective way of marketing than mass marketing, as it allows businesses to
focus their resources on the customers who are most likely to be interested in their products or services.

Machine learning can help with targeted marketing in a number of ways, including:

● Segmenting customers: Machine learning algorithms can be used to segment customers into different
groups based on their demographics, behavior, and other factors. This information can then be used
to target different marketing messages to different customer segments.
● Predicting customer behavior: Machine learning algorithms can be used to predict customer behavior,
such as the likelihood of a customer making a purchase or churning. This information can be used to
target marketing messages to customers who are most likely to be interested in them.
● Personalizing marketing messages: Machine learning algorithms can be used to personalize
marketing messages to individual customers. This can be done by taking into account the customer's
past purchase history, browsing behavior, and other factors.

b) A bank manager is given a data set containing records of 1000s of applicants who have
applied for a loan. How can AI help the manager understand which loans he can approve?
Explain. [5 Marks]
AI can help a bank manager understand which loans he can approve by using machine
learning to build a credit scoring model. A credit scoring model is a statistical model that
predicts the likelihood of a borrower defaulting on a loan. The credit scoring model is
trained on a dataset of historical loan data. This data includes information about
borrowers, such as their credit history, income, and employment status. The model is also
trained on information about loan defaults. Once the model is trained, it can be used to
score new loan applicants. The model will generate a score for each applicant, which
indicates the likelihood of that applicant defaulting on the loan. The bank manager can
then use this information to make decisions about which loans to approve. For example,
the manager may decide to approve loans for borrowers with a high credit score and
reject loans for borrowers with a low credit score.
Or AI can be employed in the following ways:
● Credit Scoring Models: Machine learning models can analyze historical data to
develop credit scoring systems. These models consider various factors such as
credit history, income, debt-to-income ratio, and employment status to predict the
creditworthiness of an applicant.
● Risk Prediction: AI models can predict the risk associated with approving a loan for
a particular applicant. By analyzing patterns in past loan data, these models can
assess the likelihood of repayment and default.
● Automation: AI can automate the loan approval process by quickly analyzing and
validating large sets of applicant data. This reduces the time it takes to make
lending decisions and improves efficiency.
● Fraud Detection: AI algorithms can detect anomalies in the data that may indicate
fraudulent loan applications, adding an additional layer of security to the approval
process.
● Dynamic Decision-Making: Machine learning models can adapt and learn from
new data, allowing the bank to continuously refine its loan approval criteria based
on changing economic conditions and customer behaviors.

c) You’ve won a 2-million-dollar worth lottery’ we all get such spam messages. How can
AI be used to detect and filter out such spam messages? [5 Marks]

AI can be used to detect and filter out spam messages by using machine learning to
build a spam filter. A spam filter is a software program that analyzes emails and
identifies spam messages. The spam filter is trained on a dataset of labeled emails.
This data includes spam messages and non-spam messages. The model is trained to
identify the features that are common to spam messages, such as the words and
phrases used, the IP address of the sender, and the subject line of the email. Once the
model is trained, it can be used to filter new emails. The model will analyze each
email and generate a score, which indicates the likelihood of that email being spam.
The email client can then use this information to filter out spam messages. For
example, the email client may decide to move spam messages to a spam folder or to
delete them outright.

or

● Natural Language Processing (NLP): AI-powered NLP algorithms can analyze


the content of messages to identify patterns associated with spam. This includes
detecting phishing attempts, fake offers, and other characteristics common in
spam messages.
● Machine Learning Classifiers: Supervised machine learning models can be
trained on labeled datasets containing examples of spam and non-spam
messages. These models can then classify incoming messages as spam or
legitimate based on learned patterns.
● Behavioral Analysis: AI systems can analyze user behavior, such as email
opening patterns and interactions, to identify deviations that may indicate spam
or phishing attempts.
● Pattern Recognition: AI algorithms can recognize patterns in the structure and
content of spam messages, including the use of certain keywords, deceptive
language, and common spam tactics.
● User Feedback Integration: AI systems can improve spam detection by
incorporating user feedback. If users mark certain messages as spam, the
system can learn from this feedback and enhance its spam-detection capabilities
over time.
QUESTION FOUR (15 MARKS)
● Which algorithm does Facebook use for face verification and how does it work
[5 Marks]
Facebook uses a deep learning algorithm for face verification.
● Face Detection: The algorithm identifies and locates faces within an image using sophisticated
computer vision techniques.

● Feature Extraction: The facial features, such as eyes, nose, and mouth, are extracted from the
detected faces. This involves mapping the key points on the face.

● Face Representation: The extracted features are transformed into a numerical representation or
embedding, creating a unique signature for each face.

● Database Comparison: The system compares the facial embeddings of the detected face with those
stored in the database. This helps in identifying individuals and verifying their identity.

● Machine Learning Training: The algorithm is trained on a large dataset of labeled faces to improve its
accuracy and generalization capabilities.

b)Describe exhaustively the components of the following code snippet. [10 Marks]
● import numpy as np: Imports the NumPy library and aliases it as np.
● import matplotlib.pyplot as plt: Imports the pyplot module from the Matplotlib library
and aliases it as plt.
● from scipy.io import wavfile: Imports the wavfile module from the SciPy library to
read WAV files.
● SciPy is an open-source library used for scientific and technical computing in Python.
The wavfile module within SciPy provides functions to read and write WAV files, a
common format for audio data.
● Reading WAV File:
● frequency_sampling, audio_signal = wavfile.read("/Users/Omol/audio_file.wav"):
Reads a WAV file located at "/Users/Omol/audio_file.wav" using the wavfile.read
function. The sampling frequency is stored in frequency_sampling, and the audio
signal is stored in audio_signal.
● Printing Signal Information:
● print('\nSignal shape:', audio_signal.shape): Prints the shape of the audio signal array.
● print('Signal Datatype:', audio_signal.dtype): Prints the data type of the audio signal
array.
● print('Signal duration:', round(audio_signal.shape[0] / float(frequency_sampling), 2),
'seconds'): Prints the duration of the audio signal in seconds.
● Normalizing Audio Signal:
● audio_signal = audio_signal / np.power(2, 15): Normalizes the audio signal by
dividing it by 2^15.
● Selecting a Subset of Audio Signal:
● audio_signal = audio_signal[:100]: Takes the first 100 samples of the audio signal.
● Creating Time Axis:
● time_axis = 1000 * np.arange(0, len(signal), 1) / float(frequency_sampling): Creates a
time axis in milliseconds based on the length of the signal and the sampling
frequency.
● Plotting the Audio Signal:
● plt.plot(time_axis, signal, color='blue'): Plots the audio signal against the time axis
with a blue line.
● plt.xlabel('Time (milliseconds)'): Sets the x-axis label.
● plt.ylabel('Amplitude'): Sets the y-axis label.
● plt.title('Input audio signal'): Sets the plot title.
● Displaying the Plot:
● plt.show(): Displays the plot.

You might also like