4. Is It You, Cody?
by CodeChum Admin
Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct.
Now, will you take on this task?
Input
A line containing four one-letter strings separated by a space.
c·O·D·y
Output
A line containing a string.
Correct
Find latitude and longitude of utmost 20 countries, ordered by population, with a population greater or equal to the population limit given below and have atleast one currency exclusively for themselves. (countries like Madagascar, Sri Lanka but not India, USA). Use the country details from this dataset.
Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.
Population limit: 15933883
Note: Population limit will change at random intervals. So please make sure answer is computed for the correct population limit before submitting.
8 How many nodes are searched in the worst case when the search() method is called on a Linked List?
A Searching a Linked List is done in O(log n) time because you can use tree search
B One of the benefits of a Linked List is that it can be searched in constant time
C In the worst case, the method returns an error if the data to search for is not found
D In the worst case, the data to be found is the last node of the Linked List, so all the nodes must be searched
9 The remove() method we coded in the course removes _________
A All occurences of nodes containing the data to be removed
B Only the last occurrence of a node containing the data to be removed
C The first Occurrence of a node containing the data to be removed
10 The size() and search() mthods of the Doubly-Linked List are the same as the size() and search() methods for the Singly-Linked List
A True
B False
5 What is the main difference between the Doubly-Linked List(DLL) node class and the Singly Linked List(SLL) Node Class?
A The DLL node class has a previous attribute, but the SLL node class does not
B The SLL node class has a next attribute, but the DLL class does not
C The DLL node class stores two data values while the SLL node class stores only one data value
D An instance of the DLL node class can be associated with up to two Linked Lists, but an instance of the SLL node class can only be associated with one Linked List
6 Removing the first node of a Linked List is handled differently than removing other nodes in the Linked List?
A True
B False
7 The time complexity of the size*( method is O(n)
A True
B False
1 How can you tell if a Linked List is empty?
A the head points to Null
B the head points to None
C the head points to a node whose data value is empty
D all the nodes data values are None
2 Which of these is not associated with nodes in a Linked List?
A an edge value
B a data value
C previous pointer
D next pointer
3 Python’s built in list data type is implemented using a ______________.
A simple array
B dynamic linked list
C dynamic array
D simple linked list
4 What are the attributes associated with the Singly-Linked List node class?
A next and previous
B data, next, and previous
C data and next
D next only
Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".
Let's try this out now!
Input
A line containing two integers separated by a space.
777·7
Output
A line containing a string.
Jackpot!
Create a class to implement a queue using a circular array[20 marks]
a. The class should contain functions to
i. Insert a new value, [5 marks]
ii. Delete a value. [5 marks]
iii. Change a value equal to X to a value equal to Y. [5 marks]
iv. Count all value equal to X in the queue. [5 marks]
b. For each function above perform an asymptotic analysis and state the worst case performance of the algorithm[5 marks]
Some animals can scream, others are mute. We will represent the fact of shouting by means of a method displaying on the screen the shout of the animal (Miaou, Wouf ...).
- Write an interface containing the method allowing to scream.
- Write the classes for cats, dogs and rabbits (which are mute)
- Write a program with an array of animals that can scream, fill it with dogs and cats and then make all these animals scream. Describe what is displayed on the screen when this program is run.
A university's library has been having electricity issues and students have been struggling to study during the night.
Each light source can illuminate a circle with a radius of r, and there are n tables in the library and the ith table is positioned at point (xi, yi). You have to help the university find the minimum number of light sources (k), such that each table is illuminated by at least 1 light source.
Input format
• The first line contains integers n and r respectively.
• In each of the next n lines, there are two integers representing xi and yi respectively that display the position of the ith table.
Output format
• In the first line of output, print an integer k that represents the number of light sources.
For Full Instructions and Question Please Use Those Images as reference... Please help
https://drive.google.com/file/d/1wWA7nKnFWaG5XgtzzLPymfbuqiIf7WH8/view?usp=sharing