Introduction to Programming 2015

1. What does the hash function "245 mod 10" output?
Answers:
• 7
• 5
• 8
• 10
2. True or False: Java is an Object Oriented language?
Answers:
• True
• False
3. A while...do loop is an example of a(n)...
Answers:
• fixed loop
• precheck loop
• postcheck loop
• infinite loop
4. How many decimal places are in an Integer?
Answers:
• 0
• 1
• 2
• 3
5. The correct syntax of do-while loop is...
Answers:
• while ( condition ); do { statements; };
• { statements; } do-while();
• do { statements; } while ( condition );
• ( condition) while; do { statements; };
6. Each pass through a loop is called a(n)...
Answers:
• enumeration
• iteration
• culmination
• pass through
7. True or False: Java is a cross-platform language?
Answers:
• True
• False
8. What does "!=" mean in Java?
Answers:
• True
• False
• Equal
• Not Equal
9. What digits are in Binary?
Answers:
• 0 and 1
• 0, 1, 2, 3
• 0 through 10
• 0 through 5
10. In Java, the return type of a function that does not return any value must be ____.
Answers:
• double
• int
• float
• void
11. What is an example of a "Scripting" Language?
Answers:
• JavaScript
• Objective-C
• C++
• C#
12. Which of the following is a programming language?
Answers:
• Pascal
• C++
• Java
• C#
• All of these
13. What does a compiler do?
Answers:
• Takes your programming language and converts it to machine readable code
• Takes a program and turns it into human readable code
• It packages your code in a .zip file
• Nothing, it isn't used anymore
14. What is an Array?
Answers:
• A list of values
• A non changeable variable
• A large variable
15. What does " == " check?
Answers:
• The sum of two numbers
• It prints out a variable
• Equality between two variables
• The result of a code block
16. When are "While" loops used?
Answers:
• When we don't know how many times a loop has to run, but want it to run when a criteria is active
• To halt a program
• To save memory
• If you don't have space for a for loop
17. When are "For loops" used?
Answers:
• To repeat code a known number of times
• When a value is equal
• It is only used on non object-oriented languages
18. In strongly typed languages, a variable must be ________ before it can be used.
Answers:
• reset
• removed
• declared
• erased
19. Which of the following is NOT a common data type used in most languages?
Answers:
• string
• boolean
• alphanumeric
• integer
20. If an external object or program needs direct access to a variable in your class, you should declare it as a _______ variable.
Answers:
• protected
• public
• private
• inherited
21. How many bits are in a byte?
Answers:
• 8
• 2
• 1024
• 100
22. What is a GUI?
Answers:
• A popular programming language
• A Generic User Instruction
• Text based instructions
• A graphical user interface
23. What is Programming?
Answers:
• Controlling a computer with a mouse
• Telling the computer what to do in human language
• Using a computer for spreadsheets or word processing
• Provide (a computer or other machine) with coded instructions for the automatic performance of a particular task.
24. Which of the following is a value of a boolean data type?
Answers:
• -1
• 6
• text'
• False
25. What is a variable?
Answers:
• A value that never changes
• A value that is set once and locked
• A reference to information that can change
26. What are "Nested" loops?
Answers:
• A large "while" loop
• A loop within a loop
• A large "for" loop
• A loop that assigns variables
27. What is a "Matrix"?
Answers:
• A loop that includes variables
• A multi dimensional array
• An array with a list of values
28. A _______ is a computer program that transforms source code into another computer language; usually in order to create an executable program.
Answers:
• Compiler
• Third-Generation Programming Language
• Fourth-Generation Programming Language
• Debugger
29. How many bits are in a byte?
Answers:
• 8
• 4
• 16
• 24
30. C++ is:
Answers:
• procedure oriented
• object oriented
• method oriented
• none of these
31. What does " = " do?
Answers:
• It removes code from being executed
• It assigns a value to a variable
• It checks for equality
32. True or False? Floats include decimals
Answers:
• False
• True
33. _______ is a programming paradigm that uses objects to contain data fields and associated programs called methods.
Answers:
• imperative programming
• procedural programming
• web programming
• object oriented programming
34. Which of the following is the starting index of an array in C++?
Answers:
• 1
• -1
• 0
• any number
35. Given the following code logic, when will statement 1 be executed? If (condition) then    statement 1 else     statement 2 end if
Answers:
• When the condition is true.
• When the condition is false.
• Statement 1 will never be executed.
• When the condition is true or false.
36. A precise sequence of steps to solve a problem is called a(n)...
Answers:
• routine
• program
• algorithm
• statement
37. In C++, what does the "%" operator do?
Answers:
• Multiplication
• Addition
• Division
• Modulo
38. What does "||" mean in Java?
Answers:
• OR
• IF
• AND
• NOT
39. ______ is an identifier whose value cannot be altered by the program during execution.
Answers:
• Parameter
• Attribute
• Constant
• Variable
40. A garbage collector does what?
Answers:
• Reclaims memory occupied by data that is no longer in use.
• Collects and disposes of junk email.
• Allocates memory for new objects.
• Cleans up garbage on the screen.
• Takes out your office garbage.
41. What is debugging a program?
Answers:
• Testing the program
• Finding and fixing errors in your program.
• Introducing errors in the program to see how it holds up
• Usability Testing
42. && is a(n) ______ operator:
Answers:
• logical
• unary
• relational
• arithmetic
43. Integer, boolean, and string are examples of a _________.
Answers:
• object
• variable
• class
• data type
44. Given the following code logic, when will statement 2 be executed? If (condition) then    statement 1 else     statement 2 end if
Answers:
• When the condition is false.
• When the condition is true or false.
• Statement 2 will be executed when statement 1 is executed.
• When the condition is true.
45. Which is more efficient?
Answers:
• i += j;
• i = i + j;
46. Which of the following is NOT a commonly used comparison operator?
Answers:
• Less than or equal to
• Greater than
• Equality
• Assignment
47. ______ is a collection of data items of the same size and type that can be selected by indices computed at run-time.
Answers:
• Array
• Object
• Function
• Method
48. A ________  variable refers directly to another value stored elsewhere in the computer memory using its address.
Answers:
• object
• function
• class
• pointer
49. How do you print "Hello World" in C?
Answers:
• printf("Hello World")
• println("Hello World")
• println(Hello World)
• printf(Hello World)
50. Which of the following is NOT an object oriented programming language?
Answers:
• C++
• Ruby
• COBOL
• JAVA
51. Given a = true, b = false; what is the value returned by (a and b)?
Answers:
• 1
• 887
• 777
• False
52. Which of the following is NOT an Integrated Development Environment (IDE)?
Answers:
• DreamWeaver
• Visual Studio
• FrontPage
• Notepad
53. What does ASCII stand for?
Answers:
• American Standard Code for Information Interchange
• Analytical Student Comprehension Intelligence Index
• Analytical Standard Code for Information Interchange
• Automation Standards for Computing Information Institution
54. Which of the following is NOT a key concept in object oriented programming?
Answers:
• Inheritance
• Encapsulation
• Looping
• Abstraction
55. How do you print "Hello World" in Java?
Answers:
• System.out.println (Hello World)
• System.out.println ("Hello World")
• System.out.printOut ('Hello World')
• System.out("Hello World")
56. In flow chart, the symbol used for decision making is...
Answers:
• arrow
• circle
• rectangle
• diamond
57. Hiding internal data from external programs or objects and allowing access to it through only publicly declared methods is known as ___________.
Answers:
• internal data
• data protection
• data inheritance
• data encapsulation
58. An example of a LIFO (Last In First Out) data structure is ...
Answers:
• a stack
• an array
• a hash
• a queue
• a map
59. ________ passes a direct reference of a variable to the procedure and the procedure can change the value of the calling program's variable.
Answers:
• A class
• Pass by reference
• Pass by value
• An object
60. What type of loop executes at least once before checking the condition?
Answers:
• For
• Do OR Do While
• While
• All of them
• None of them.
61. Given a = true, b = false; what is the value returned by (a or b)?
Answers:
• False
• True
• 1
• 0
62. _______ is the set of rules that defines the combinations of symbols that are  considered to be a correctly structured code line or fragment in that  language.
Answers:
• ASCII
• Standards
• Syntax
• Programming language
63. A ________ is a programming language that executes instructions directly, without  previously compiling a program into machine-language instructions.
Answers:
• object oriented languages
• HTML
• interpretted language
• compiler
64. C Language was developed for which OS?
Answers:
• UNIX
• Windows
• LINUX
• Other
65. _______ passes a copy of a variable's value to a procedure and the procedure cannot change the value of the calling program's variable.
Answers:
• A class
• Pass by reference
• Pass by value
• An object
66. For a compiled language, when do syntax errors occur?
Answers:
• It's impossible to have syntax errors in a compiled language.
• Compile-time
• Run-time
• Both compile-time and run-time
67. What is the control variable of a loop called?
Answers:
• global variable
• index variable
• local variable
• private variable
68. What is the difference between a function and a procedure?
Answers:
• A procedure accepts input parameters; a function does not.
• A procedure returns a value; a function does not.
• A function returns a value; a procedure doesn not.
• A function accepts input parameters; a procedure does not.
69. In order for a binary search to work on an array, which of the following must be true?
Answers:
• The array must be partitioned into two lists.
• The array cannot be sorted.
• You cannot binary sort an array.
• The array must be sorted.
70. What is a parent node in a tree structure?
Answers:
• A node that is the root
• A node that has at least one child node
• A node that owns intself
71. A do while loop is an example of a ...
Answers:
• infinite
• postcheck loop
• precheck loop
• fixed loop
72. Which of the following is NOT an interpretted language?
Answers:
• Javascript
• Ruby
• C++
• PHP
73. What is this called: var = (foo == bar) ? 'foo' : 'bar';
Answers:
• Ternary operator
• Boolean operator
• Special operator
• Unary operator
74. What is the largest value that be stored in a byte?
Answers:
• 255
• 10
• 1
• 8
75. What is the decimal value of the hexadecimal number "FF" ?
Answers:
• 0
• 254
• 1024
• 255
• #FFFFFF
76. A ______ is a machine level programming language.
Answers:
• Object Oriented programming language
• compiler
• First-Generation programming language (1GL)
• Second-Generation programming language (2GL)
77. What is the decimal value of the binary number 101?
Answers:
• 101
• 2
• 5
• 9
78. What type of loop is shown in the following code? a = 1 i = 0 while (a < 2) {    i = i+1 }
Answers:
• Control loop
• For loop
• Infinite loop
• Do loop
79. Given the following code, what will be the value of i when the loop finishes executing? a = 5 i = 0 while (a < 2) {    i = i+1 }
Answers:
• 10
• 5
• 0
• 2
80. What is the value of an integer variable before it has been instantiated?
Answers:
• NULL
• 0
• a variable must be instantiated upon creation
• 1
• Depends on the language specification
81. Which of the following is NOT a main computer system component?
Answers:
• main memory
• secondary storage device
• operating system
• CPU
82. The compiler of the C language is written in...
Answers:
• UNIX
• Fortran Language
• Java Language
• C Language
83. A linked data structure where the nodes have two pointers, one to the previous node, and one to the next node, is known as a(n)...
Answers:
• queue
• linked list
• array
• doubly linked list
• binary tree
84. In C, when a pointer is incremented, it actually jumps the number of memory address...
Answers:
• 1 byte exactly
• according to data type
• 1 bit exactly
• a pointer variable can not be incremented
85. If the elements of an array are already sorted then the useful search algorithm is...
Answers:
• Linear search
• Binary search
• Quick search
• Random search
86. Which of the following does NOT evaluate to true?
Answers:
• NOT false
• true or false
• NOT (true or false)
• (NOT false and true)
87. Which of the following must be true in a Binary Tree?
Answers:
• A Binary Tree's nodes have not more than two child nodes, typically named 'left' and 'right'.
• None of these.
• If either children node of the Tree is null, then the other node must also be null.
• The value of left node must be less than the value of the right node.
88. An example of a single pass language is
Answers:
• Java
• Ruby, Perl
• C++, C#, C
• Objective C
89. ________ is an error in the design of the code; the code does not run as expected.
Answers:
• Syntax Error
• None of these
• Logical Error
• Runtime Error
90. Number of primitive types in java?
Answers:
• 10
• 7
• 6
• 9
• 8
91. Which is the correct order of complexity, from fastest growing to slowest growing:
Answers:
• O(2^n), O(n^2), O(log(n)), O(n), O(n*log(n)), O(1)
• O(n^2), O(2^n), O(n*log(n)), O(n), O(log(n)), O(1)
• O(2^n), O(n^2), O(n*log(n)), O(n), O(log(n)), O(1)
• O(n^2), O(2^n), O(log(n)), O(n), O(n*log(n)), O(1)
92. True or False: You need a sorted array when doing an linear search.
Answers:
• False
• True
93. Java, Python, C, C++ are examples of
Answers:
• Human Language
• Functional Language
• Imperative Language
• Logic-based Language
• Interpreted Language
94. The stream-insertion operator is >> and the stream-extraction operator is <<
Answers:
• False

• True

No comments:

Post a Comment