CPSC101- Test1- Answers

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/30

flashcard set

Earn XP

Description and Tags

Flashcards about CPSC101 Test 1

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

31 Terms

1
New cards

What invention replaced vacuum tubes and made computers smaller and faster?

Transistor

2
New cards

What is the sequence of the software used to transform source code to machine code?

Preprocessor, compiler, assembler, linker

3
New cards

Who created 'The Analytical Engine,' a machine that led to the creation of computers?

Charles Babbage

4
New cards

Who created the first computer program?

Ada Lovelace

5
New cards

What software is used first when you turn on your computer?

basic input output system

6
New cards

What is the fifth generation of computer science characterized by developing?

Mobile devices and supercomputers

7
New cards

What are the function of operating system?

Memory management, security to protect user data

8
New cards

What are the types of application software?

Editing spreadsheet, spelling check

9
New cards

List the speed of the following devices from slowest to fastest

DVD, RAM, Cache, registers

10
New cards

What are the input and output of the compiler?

High level code, Assembly code

11
New cards

What are the fastest high-performance computers?

Supercomputers

12
New cards

What are some examples of Volatile memories?

Dynamic RAM, Cache, registers

13
New cards

What is the output of the following pseudo code? Count is a number = 250 while (Count > 0) show Count %5 divide Count by 5

0 0 0 2

14
New cards

What is BigO of the problem? Count is a number = 250 while (Count > 0) show Count %5 divide Count by 5

logn

15
New cards

What is the output of the following pseudo code? S=[10,2,3,60,1,78,-12, 55 ], len=length of S, i=0, j=0 while i< len while j < len -i if S[j] > S[j+1] # notice the condition swap S[j], S[j+1] increment j by 1 increment i by 1 print the list

-12, 1,2, 3, 10, 55, 60, 78

16
New cards

What is BigO of the following pseudo code? S=[10,2,3,60,1,78,-12, 55 ], len=length of S, i=0, j=0 while i< len while j < len -i if S[j] > S[j+1] # notice the condition swap S[j], S[j+1] increment j by 1 increment i by 1 print the list

O(n^2)

17
New cards

What is the output of the following pseudo code? Define number n Set n= 10034 total=0 While n > 0 print n%10 add n to total n= integer (n/10) Print total

4 3 0 0 1

18
New cards

What is the total of the following pseudo code? Define number n Set n= 10034 total=0 While n > 0 print n%10 add n to total n= integer (n/10) Print total

11148

19
New cards

What is BigO of the following pseudo code? Define number n Set n= 10034 total=0 While n > 0 print n%10 add n to total n= integer (n/10) Print total

O(logn)

20
New cards

What is the output from the following pseudo code? Define numbers n1 and n2 Set n1=n2=2 While n1< 5 While n2< 4 print n1, n2 Increment n2 by one Increment n1 by one n2=2

2 2 2 3 3 2 3 3 4 2 4 3

21
New cards

What is the BigO from the following pseudo code? Define numbers n1 and n2 Set n1=n2=2 While n1< 5 While n2< 4 print n1, n2 Increment n2 by one Increment n1 by one n2=2

O(n^2)

22
New cards

What is the output of the following pseudo code? Set n= 7 While n < 15 Increment n Print n

9 11 13 15

23
New cards

What is the BigO of the following pseudo code? Set n= 7 While n < 15 Increment n Print n

O( n)

24
New cards

What is the output of the following pseudo code? def linearsearch(arr, x): for i in range(len(arr)): if (arr[i]==x): return i return -1 # Testing list=[6 ,7,100,400,500] print(linearsearch(list, 100))

2

25
New cards

What is the BigO of the following pseudo code? def linearsearch(arr, x): for i in range(len(arr)): if (arr[i]==x): return i return -1 # Testing list=[6 ,7,100,400,500] print(linearsearch(list, 100))

O(n)

26
New cards

Use binary search in the following List of numbers={90, 85, 80, 75, 65, 60, 55, 52, 10, 6} to search for 6. What is the time of the algorithm?

Log(n), 4 rows

27
New cards

What is output of the following code? i=0 a=[1, 23,55,78,3,15,98] while i in range(len(a)): if(a[i] %5 == 0): print(a[i] ,end= ', ‘) i=i+1

55 , 15

28
New cards

What is the output of the following code? v = [1, 2,4, -6, -9, 10,11] a=[3*x for x in v if x > 3] print(a)

[ 12, 30, 33]

29
New cards

What is the output of the following code? v1= [2,4,6 ], v2 = [2,3,4] a=[ v1[i]*v2[i] for i in range(len (v1))] print (a)

[4, 12, 24]

30
New cards

What is the output of the following code? list=[10, 11, 23, -10, 100, 90] a= b= list[0] i=1 while i

100 , -10, 4, 3

31
New cards

What is the output of the following code? number = 25 bin =binary(number) print(bin)

11001