Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Determining whether to use Insertion Sort or Bubble Sort is a question of which _____ to use. Which of the following are part of a programming language? loops, variables, integers, sub routines, or functions? True/False – Any process that can be completely described can have an algorithm or program written for it. I add the following items to a stack and a queue and array, Apple, Banana, Chocolate Bar? In what order will they be retrieved from the stack, queue, and array respectively? In Object Oriented Programming (OOP) we combine primitive types, objects, and methods into a ____ which in turn can be used to create other _____s. The following is the recursive definition of the 10th Fibonacci sequence. Fib (10) = Fib (9) + Fib (8). What would be the recursive definition of 10 to the power of 3 using the Power function below? Power (10, 3) = 10 * Power(__, __) The following is an example of OOP. In Excel, one Workbook object can contain many W____s. What will the following value of X be after these loops? N=3 FOR X = 1 THROUGH 3 IF X= 2 THEN N=N*2 END IF END FOR LOOP N=2 X= 5 WHILE N > 1 X= X + 5 N=N-1 END WHILE LOOP Fix the Swap Subroutine below: // This is used, for example, when sorting numbers e.g. if A(0) > A(1) then Swap(A(0),A(1)) Procedure Swap(Num1 as Integer, Num2 as Integer) Num1 = Num2 Num2 = Num1 End Procedure I need to create a variable to hold my GPA. What variable type should I pick? Real (has numbers after the decimal point e.g. 2.7) String (e.g. “Hello World!!”) or Integer (is a whole number e.g. 2 or 4)? I have a list of numbers 1,10,3,9,8,7,5,6,2,4. Using Bubble Sort what will the list look like after 1 time looping through the list? Using Merge Sort what will the list look like after 1 time looping through the list? Using Partition Sort what will the list look like after 1 time looping through the list? Using Insertion Sort what will the list look like after 5 insertions? Using the binary search tree below: Which node is the parent of node 2? What are the children of node 1? What are the children of node 4? How many searches will it take to discover that 35 is not part of this tree? A strictly greedy algorithm would travel in the following path? Is this actually the shortest path? Is the knapsack problem solvable through brute force? Can you think of any real world applications of the knapsack problem? How would you solve the Traveling Salesman Problem? 1. How the two problems below can be solved using sorting and binary numbers? a. Finding median number in a list of numbers. b. Calculating how many subsets exist in a set of items. For example the set {A,B} has four possible subsets. {}, {A}, {A,B}, {B}. I have a stack, queue, and array that I add an Apple, Banana, and Clementine. Which element will be the first to be removed from each of these data structures? Describe the Turing Test? What does LIFO and FIFO stand for? True/False Arrays are fast to access individual items. True/False Lists are slower to access individual items but are quick to add and delete individual items. Array List of objects where the objects can be randomly accessed because each object takes up the same amount of space. Advantage: quick random access. Disadvantage: inserting and deleting items requires re-shifting all contents. Example ARRAY OF 9 NUMBERS. ALL THESE NUMBERS USE AN EQUAL AMOUNT OF SPACE. SO IN THE EXAMPLE BELOW, WE CAN SAY THINGS LIKE ARRAY (2) IS EQUAL TO 67. Value 23 34 67 88 89 67 777 888 773 Index # 0 1 2 3 4 5 6 7 8 List A List is a bunch of objects in sequential order. Disadvantage: quick random access. Advantage: inserting and deleting items is very efficient. List of Numbers 23 34 67 88 89 67 Queue FIFO - A line at the supermarket or bank is an example of a queue. Also a queue has a pointer to the front called the head where items are removed and a pointer to the end called the tail where items are added. Problems solved using queues are print queues and anywhere that order is important. Stack LIFO Any shoebox or drawer is an example of LIFO. Stacks are used in algorithms which require that the last item added is the first item to be removed. 89 88 67 34 23 A Primary Key: Uniquely Identifies every row in a table. Can contain one or more columns. Is Often found in other tables as a foreign key. CRUD – Stands for Create, Read, ____, and Delete? What does the “U” stand for? The Traveling Salesman Problem (TSP) is: Can be solved using brute force. Represents a class of problems that take so long to solve that we consider them unsolvable. A relational database is better at storing data than a workbook with many worksheets: Because a database enforces data integrity, for example, only valid dates may be entered into a date field. Because a database allows tables to be joined (connected), allowing for easy data extraction. A properly designed database will not have data repeated more than necessary. HTTPS: Stands for Hypertext Transmission Protocol Secure Socket Layer. Encrypts your web data using a public key found on a web site and decrypts your data using a private key found on its web site. When in use, a lock symbol often appears on your browser. Sending your Resume in PDF format rather than as a Word document is a good idea because Word documents require Word to read while even some web browsers can view PDF files. Web Sites vs. Web Pages: Web sites are places where one can request a web page. A web page is a document like a Word or PDF document, while a web site is actually a program running on web server that returns web pages. Which of the following is NOT a valid HTML tag or element. <html> <head> <title> Test HTML Page </title> </head> <body> <cs012> Introduction to Computer Science </cs012> </body> </html> Computers internally use the binary number system to store data, pictures, and compute because computers store and manipulate using electricity and the digits used in binary are 0 or 1, these digits can be easily translated by electricity into the electrical on/off states. There are: 8 bits in a byte. 1000 bytes in a kilobyte (kb). One million bytes in a megabyte. Computers start up in the following order: BIOS->OS->Programs (startup programs like anti-virus etc.) From slowest to fastest: HDD (Hard Drive), RAM (Random Access Memory), CPU 1) 2) 3) 00112 = 310 10002 > 710 01112 = 710 TRUE or FALSE: Even after erasing all your files on a computer, it is dangerous to just throw away your computer because your data is really still on your computer. Just the FAT, the directory that points to the location of your file has been deleted. Having a large amount of memory (RAM) on your computer (> 2 GB) is necessary when: Handling or manipulating large files such as images. Recording video. Latency regarding internet traffic: Is why Google places web servers in different parts of the world. Is higher on a smart phone using cellular internet than when using WIFI internet from Queens College. Is similar to light years regarding distances between planets. The Operating System: Multitasks, allowing multiple programs to run at the same time. Manages the memory and disk space that programs access. Informs a program when a user enters a key stroke or clicks the mouse. HTTP web pages maintain a stateless connection with their server. The client must remind the web server who they are, every time they make a web request through a session id or data stored in a cookie. It is possible for someone to hijack a session by copying someone else’s session id. An IP Address consists of 4 numbers each number each of which is a byte or a number between 0 and 255. A computer that has a WIFI connection: Always has changing IP addresses. Will have a private network address as well as a public ID address. The following are valid services offered by a server: HTTP HTTPS FTP SQL SERVER A message sent through the internet: Usually goes through different routers before it finds the IP address it has been sent to. Is usually broken up into many different packages or packets which travel independently and are reconstituted by the receiver. Is assumed to be monitored by anyone. Regarding images: For the best quality I should use RAW or BMP. For the smallest images I should use GIF. For a compromise (smaller size but pretty good quality) I should use JPG. The problem with JPG is that it is loses quality each time it is modified. Some formats save images as lines or shapes and some save them as pixels or bitmaps the disadvantage of bitmaps being that they lose their quality when enlarged too much. Regarding Audio and Movies: For the best sound I should use .WAV files. For smaller file size I should use MP3 or MP4. Internet Security: I should use only secured WIFI connections which means that data between my computer and router are encrypted. I should use a VPN so even my visited sites are not visible to anyone. WIFI networks which requiring signing in are not always secure after signing in. Never send any private data through emails unless the connection is encrypted. I should use Tor so no one even knows which web sites I am visiting. The following are good safety practices: Never hit unsubscribe to an Email since that causes SPAM. To protect against worms, I should have my firewall enabled. I should always click on a link in an email. I should never click on an attachment from an unexpected email address. Regarding downloading programs from the internet, I should: Download Android apps rather than Apple store apps. Install an antivirus/anti malware program. Google the program to see if it is known to have viruses or it tracks in ways that violate user’s privacy.