Practice Questions - Intense PDF

Title Practice Questions - Intense
Author M. T.
Course Computer Science
Institution High School - Canada
Pages 4
File Size 77 KB
File Type PDF
Total Downloads 47
Total Views 136

Summary

Notes...


Description

These questions are meant to push you, to make you use all the skills you’ve learnt so far. They belong to no one category. Good luck. “So, young master - do you think you’re ready? Take the sword, and slay the beast.” ==================================================================== “1 - Separator” The user will input a string, then a single character. Output each part of the string separated by the character on different lines. Sample Input: APPLE-PIE-? Sample Output: APPLE PIE ? ==================================================================== “2 - Abbreviator” The user will input an organization's name. Output the abbreviation for that organization, omitting the words "of", "and", "an", "the", and "for". Sample Input: National Agency for Coders and Spaghetti Sample Output: NACS ==================================================================== “3 - Alphabet” Have a string storing all the letters of the alphabet. The user will keep inputting numbers from 1 to 26, and specify that they want to stop inputting with 0. The switching will also wrap around (if the user enters 1, the last and second letters should switch). Every time the user inputs a number, swap the letters directly before and after the number in the alphabet. When the user exits, put the changed alphabet onto the screen. Sample Input: 3 0 Sample Output: ADCBEFGHJIKLMNOPQRSTUVWXYZ D and B are switched, they were around the 3rd letter.

==================================================================== “4 - Directions” Tom starts at the coordinate position (x=0,y=0). The user will input a string without spaces consisting of the capitals letters "N","S","E", and "W". Tom will follow these directions, moving by 1 coordinate space each time. Put his final coordinates on the screen. Sample Input: NNW Sample Output: (-1,2) ==================================================================== “5 - Chatroom” Bill is in an online chatroom. Many teenage boys like to make their profile appear to be a female. Bill is trying to decipher who is a female and who is a male. In this scenario, if the username’s length is a prime number the user is female (guys are unintentionally conformists who stick to multiples of 2 or 5). For a boy, output “BOY”, and if its a girl, output “GIRL” Example Input: Grislan Example Output: GIRL ==================================================================== “6 - Progress Reports” It’s that time of year again, full of misery and despair. Teachers have better things to worry about than inducing emotion in unstable teens, so they need you to help them write their reports. They’ll input a string, and then a student’s name (on separate lines). At every occurrence of “*” in the string you need to insert the student’s name. Sample Input: * has no idea what he’s doing. Please talk thoroughly with *, as he needs to understand that there’s more to life than Clash Royale. It’s distracting * from his school work and social life. TheLegend27 Sample Output: TheLegend27 has no idea what he’s doing. Please talk thoroughly with TheLegend27, as he needs to understand that there’s more to life than Clash Royale. It’s distracting TheLegend27 from his school work and social life.

==================================================================== “7 - Bunny Corpses” Bobo the Clown is having a bad day. In fact, all N of his pet bunnies feel

his anger. Each bunny is positioned in his bedroom at an x-position and a y-position. Bobo (in his state of instability) will murder all the bunnies within D metres of him. Output the number of bunny corpses the Friendly Town Cops will find tomorrow, when Bobo is long gone and on the run. Input Format: The first line of input will be N. The second line of input will be D. The third line of input will be Bobo’s X and Y position (separated by a space). The next N lines of input will contain the X and Y positions of each of Bobo’s bunnies (separated by a space). Sample Input: 3 3 00 12 5 -4 03 Sample Output: 2 ==================================================================== “8 - Calculatrice” Holly has always been bad at math, so she needs your help when studying for her ADDITION CULMINATING project. She wants you to make a program that can take a string of addition commands (“1+5+6”) and output their result. The input will be one line, starting and ending with a number. There will be at least 1 “+” symbol between the beginning and the end of the input. There will be no consecutive “+” symbols. Sample Input: 1+500+89 Sample Output: 590 ==================================================================== “9 - PRESTO”. The user will input a string representing a line of people at a PRESTO gate. A “Y” represents a person with a PRESTO card, while a “N” represents a person without one. As people are nice (and compactable), a person with a PRESTO card will let everyone behind them pass through the gate until another person with a PRESTO card appears. Output the maximum number of non-PRESTO card holders through the gate at once. Sample Input: YNNNYNNNNYYNY

Sample Output: 4 ==================================================================== “10 - Yell Spam” Welcome to World of Procrastination (the new hit MMO). To help monitor and keep our chat streams fun, we want to filter out “yell spam”. The user will input a message. If the message has more than 5 consecutive capital letters, put “YELL SPAM”. Otherwise, put “OK”. Sample Input: WHOOOOOOOA Sample Output: YELL SPAM...


Similar Free PDFs