OC userin Computer Science·21 Mar 2018I DOLCI 9. Consider a method with the header: public static void method (String x) Is method ( (String) 10) a valid way to call it? Write YES or NO
OC userin Computer Science·20 Mar 20186. Which answers apply to this program? Mark ALL that apply. int counter = 0; void draw() { background (255); int xpos = width - (2* counter) fwidth; fill (255,0,0); ellipse (xpos, 25, 5, 5); fill(0,255, 0); ellipse (counterswidth, 75, 5, 5); counter = counter + 1; A. The red circle is moving faster than the green circle. B. Most of the time the red one is moving right to left and the green one left to right. C. Most of the time both are moving from left to right. D. Most of the time both are moving from right to left. E. None of the above apply.
OC userin Computer Science·21 Mar 201835. Recall that a domain name, e.g. www.eecs.yorku.ca, is used to identify computers on the Internet. The main responsibility of a Domain Name Server (DNS) is to a) Keep track of registered domain names and their associated IP addresses. X b) Administer the assignment of IP addresses over the internet. c) Administer assignment of domain names on the Internet. d) Promote open development of the Internet for global benefit. e) None of the above
OC userin Computer Science·22 Mar 201816. You are writing a method findUppercase that takes as input a phrase and returns an array that contains all of the upper case letters in the input phrase. What does the method header look like? Just write the header. Do not write the whole method. If you think there is more than one possible correct answer, just answer one of them.
OC userin Computer Science·21 Mar 201812. What prints when the following code executes? Scoate cele public static void main(String[] args) { int x = 4; int y = 5; System.out.println(x + "+" + y + " is " + x + y);
OC userin Computer Science·14 Mar 201832. Line 7 (A) return temp; } (B) return counter;} (C) None of these statements are useful when paired with other questions, leave blank. (D) return ++temp; } (E) } }
OC userin Computer Science·14 Mar 201810. How many rectangles are drawn? int ypos = 0; while (ypos != 50) { rect (yPos, ypos, 20, 40); yPos - ypos + 10; A. 0 B. 4 C. 5 D. 50 E. more than 50
OC userin Computer Science·12 Mar 20181. Object oriented programming paradigm is useful because it allows us to write more efficient programs (in terms of running time). (A) FALSE (B) TRUE
OC userin Computer Science·12 Mar 201812. What does the following program print? void setup int x = 6, y = 3; print Product (x, y); X = 2; print(" "); print Product (x + y, x); void print Product (int x, int y){ print (x * y);
OC userin Computer Science·10 Mar 201816. Which one of the following tasks is the responsibility of an operating system? a) Process management b) Memory management c) Device management d) File systems e) All of the above x
OC userin Computer Science·11 Mar 201830. What is the first word printed by the program to the right? A. funci B. func2 C. func3 void setup() { funci (func2(func3 (2))); void funcl (int x) { println("funcl " + x); int func2(int x) { funci (x); println("func2"+x); return x*x; int func3(int x) { int y = func2(x); println("func3" + x); return y;
OC userin Computer Science·10 Mar 201814. How many times does the word "hello" get printed when the following snippet of code is executed? int i = 0; while (i < 10) { int j = 0; while (j < 5) { System.out.println("hello"); j++; i++;
OC userin Computer Science·10 Mar 201811. Which choice below will cause all of the values stored in the array data to be printed out in reverse order? Check all that int'u data = 122, 17, 95, 16, 103, -14, 95); // Choice A for (int i = data.length; i >= 1; i--) { print (data[i] + " "); // Choice B for (int i = 1; i <= data.length; i++) { print (data (data.length-i] + " "); // Choice C for (int i = data.length-1; i >= 0; i--) { print (data[i] + " "); // Choice D for (int i = 0; i < data.length; i++) { print (data (data.length-1-i] + " ");
OC userin Computer Science·7 Mar 2018Part (b) [4 MARKS] Consider this program in file words.py: Write what this program prints when you run it. Write one line per box. There are more boxes than you need; leave unused ones blank. def repeat_word(word, num_times): (str, int) -> str print(__name__) word = word * num_times print('Repeated word is:', word) return word if __name__ == '__main__': word = 'Yes' print (Original word is:', word) repeat_word(word, 3) print('New word is:', word) word = repeat_word(word, 2) + '!' print('New word is:', word)