Programming Fundamentals MCQ PDF
Programming Fundamentals MCQ PDF
MCQ PDF
https://quizplus.com/study-set/1550
13 Chapters
820 Verified Questions
Programming Fundamentals
MCQ PDF
Cou
Programming Fundamentals introduces students to the essential concepts and
techniques used in computer programming. This course covers foundational topics such
(including loops and conditionals), and the basics of functions and arrays. Through
hands-on practice in a programming language, students learn how to write, debug, and
problems in later courses. The course emphasizes logical thinking, code organization,
Recommended Textbook
Java Software Solutions Foundations of Program Design 7th Edition by John Lewis
Page 2
Chapter 1: Introduction
Available Study Resources on Quizplus for this Chatper
65 Verified Questions
65 Flashcards
Source URL: https://quizplus.com/quiz/30660
Sample Questions
Q1) What is the output of the following when the main method is executed?
public class Question4
{
public static void main(String[ ] args)
{
System.out.println("hi there");
System.out.println(" ");
System.out.println("how are you doing today?
");
}
}
Answer: hi there
how are you doing today?
Notice that while the Java compiler ignores "white space", blanks that appear in a println
statement inside of quote marks are retained and output in that manner.
To view all questions and flashcards with answers, click on the resource link above.
Page 3
Chapter 2: Data and Expressions
Available Study Resources on Quizplus for this Chatper
77 Verified Questions
77 Flashcards
Source URL: https://quizplus.com/quiz/30661
Sample Questions
Q1) A Java variable is the name of a
A) numeric data value stored in memory
B) data value stored in memory that can not change during the program's execution
C) data value stored in memory that can change its value but cannot change its type
during the program's execution
D) data value stored in memory that can change both its value and its type during the
program's execution
E) data value or a class stored in memory that can change both its value and its type
during the program's execution
Answer: C
Q2) What is output with the statement System.out.println(""+x+y); if x and y are int values
where x=10 and y=5?
A) 15
B) 105
C) 10 5
D) x+y
E) An error since neither x nor y is a String
Answer: B
To view all questions and flashcards with answers, click on the resource link above.
Page 4
Chapter 3: Using Classes and Objects
Available Study Resources on Quizplus for this Chatper
58 Verified Questions
58 Flashcards
Source URL: https://quizplus.com/quiz/30662
Sample Questions
Q1) In Java, the symbol "=" and the symbol "==" are used synonymously
(interchangeably).
A)True
B)False
Answer: False
Q3) For the program to get a name interactively a Scanner object must be instantiated.
Write the Java statement to do this.
Answer: Scanner scan = new Scanner(System.in);
Q4) The printf method within System.out is designed to ease the conversion of legacy C
code into Java.
A)True
B)False
Answer: True
To view all questions and flashcards with answers, click on the resource link above.
Page 5
Chapter 4: Writing Classes
Available Study Resources on Quizplus for this Chatper
56 Verified Questions
56 Flashcards
Source URL: https://quizplus.com/quiz/30663
Sample Questions
Q1) Which of the following could be used to instantiate a new Student s1?
A) Student s1 = new Student( );
B) s1 = new Student( );
C) Student s1 = new Student("Jane Doe", "Computer Science", 3.333, 33);
D) new Student s1 = ("Jane Doe", "Computer Science", 3.333, 33);
E) new Student(s1);
Q2) Assume that another method has been defined that will compute and return the
student's class rank (Freshman, Sophomore, etc). It is defined as: public String
getClassRank( )
Given that s1 is a student, which of the following would properly be used to get s1's class
rank?
A) s1 = getClassRank( );
B) s1.toString( );
C) s1.getHours( );
D) s1.getClassRank( );
E) getClassRank(s1);
Q3) Write a toString method that returns the player's name, position and batting
average formatted to have 1 digit to the left of the decimal and 3 digits to the right of the
decimal. Assume DecimalFormat has been imported.
To view all questions and flashcards with answers, click on the resource link above.
Page 6
Chapter 5: Conditionals and Loops
Available Study Resources on Quizplus for this Chatper
37 Verified Questions
37 Flashcards
Source URL: https://quizplus.com/quiz/30664
Sample Questions
Q1) What is wrong, logically, with the following code?
If (x > 10) System.out.println("Large");
Else if (x > 6 && x <= 10) System.out.println("Medium");
Else if (x > 3 && x <= 6) System.out.println("Small");
Else System.out.println("Very small");
A) There is no logical error, but there is no need to have (x <= 10) in the second
conditional or (x <= 6) in the third conditional
B) There is no logical error, but there is no need to have (x > 6) in the second conditional
or (x > 3) in the third conditional
C) The logical error is that no matter what value x is, "Very small" is always printed out
D) The logical error is that no matter what value x is, "Large" is always printed out
E) There is nothing wrong with the logic at all
Q2) Regarding the Software Failure: The operators were warned that, although the
Therac-25 had many safety precautions, it might be possible to accidentally overdose a
patient.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 7
Chapter 6: More Conditionals and Loops
Available Study Resources on Quizplus for this Chatper
36 Verified Questions
36 Flashcards
Source URL: https://quizplus.com/quiz/30665
Sample Questions
Q1) Rewrite the following if-else statement using a conditional operator.
if (x > y) z = x; else z = y;
Q2) You might choose to use a switch statement instead of nested if-else statements if
A) the variable being tested might equal one of several hundred int values
B) the variable being tested might equal one of only a few int values
C) there are two or more int variables being tested, each of which could be one of
several hundred values
D) there are two or more int variables being tested, each of which could be one of only a
few values
E) none of the above, you would never choose to use a switch statement in place of
nested if-else statements under any circumstance
Q3) It is possible to convert any type of loop (while, do, or for) into any other.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 8
Chapter 7: Object-Oriented Design
Available Study Resources on Quizplus for this Chatper
76 Verified Questions
76 Flashcards
Source URL: https://quizplus.com/quiz/30666
Sample Questions
Q1) The activities of the development cycle are generally thought to
A) be strictly linear
B) be rigidly ordered
C) overlap
D) have optional steps
E) both A and B are True
Q3) An object that refers to part of itself within its own methods can use which of the
following reserved words to denote this relationship?
A) inner
B) i
C) private
D) this
E) static
Q4) Explain the difference between implementing an interface and a derived class.
To view all questions and flashcards with Page 9 click on the resource link above.
answers,
Chapter 8: Arrays
Available Study Resources on Quizplus for this Chatper
70 Verified Questions
70 Flashcards
Source URL: https://quizplus.com/quiz/30667
Sample Questions
Q1) Demonstrate how the following array is sorted using Insertion Sort. Show the array
after each pass of the outer loop.
[16, 3, 12, 13, 8, 1, 18, 9]
Q2) Java arrays can store primitive types and Strings, but cannot store any other type of
Object other than Strings.
A)True
B)False
Q3) Which of the following lists of numbers would accurately show the array after the
first pass through the Selection Sort algorithm?
A) 9, 4, 12, 2, 6, 8, 18
B) 4, 9, 12, 2, 6, 8, 18
C) 2, 4, 12, 9, 6, 8, 18
D) 2, 4, 6, 8, 9, 12, 18
E) 2, 4, 9, 12, 6, 8, 18
Q4) Just as arrays can only have a fixed number of elements, set at the time the array is
declared, a parameter list also can only have a fixed number of elements, set at the time
the method is declared.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above.
Page 10
Chapter 9: Inheritance
Available Study Resources on Quizplus for this Chatper
71 Verified Questions
71 Flashcards
Source URL: https://quizplus.com/quiz/30668
Sample Questions
Q1) If a programmer writes a class wanting it to be extended by another programmer,
then this programmer must
A) change private methods and instance data to be protected
B) change public methods and instance data to be protected
C) change all methods to be protected
D) change the class to be protected
E) none of the above, the programmer does not have to change anything
Q4) You may use the super reserved word to access a parent class'private members.
A)True
B)False
Q5) Explain the difference between using an imported class and extending a class.
Page 11
To view all questions and flashcards with answers, click on the resource link above.
Chapter 10: Polymorphism
Available Study Resources on Quizplus for this Chatper
70 Verified Questions
70 Flashcards
Source URL: https://quizplus.com/quiz/30669
Sample Questions
Q1) As explained in the Software Failure, the destruction of the Ariane 5 expendable
launch system was caused by
A) strong aerodynamic forces
B) a failure of design and testing
C) a malfunction of the rocket's control system
D) over-confidence of the designers after success of the Ariane 4 system
E) all of the above
Q2) Which of the following lists of numbers would accurately show the array after the
first pass through the Selection Sort algorithm?
A) 9, 4, 12, 2, 6, 8, 18
B) 4, 9, 12, 2, 6, 8, 18
C) 2, 4, 12, 9, 6, 8, 18
D) 2, 4, 6, 8, 9, 12, 18
E) 2, 4, 9, 12, 6, 8, 18
Q4) A JSlider provides a list of String choices that the user can select between.
A)True
B)False
Q5) Is it possible to use both overloading and overriding in the same method?
Page 12
To view all questions and flashcards with answers, click on the resource link above.
Chapter 11: Exceptions
Available Study Resources on Quizplus for this Chatper
68 Verified Questions
68 Flashcards
Source URL: https://quizplus.com/quiz/30670
Sample Questions
Q1) If an exception is thrown and is not caught anywhere in the program, then the
program terminates.
A)True
B)False
Q2) Assume that you will want to save, using object serialization, a Student's name, ssn,
major and minor to a disk file. Write the instance data definitions for Student.
Q3) Write a set of code that will create 4 JButtons and add each of these to a JPanel so
that they appear in a 2x2 grid. The JButtons will not have any text appear in them (i.e. no
commands or names) but instead, will each appear as a color set by the user by using
JColorChooser.
Q5) Programmers can define their own Exceptions by extending the Exception class or
one of the descendants of the Exception class.
A)True
B)False
Q6) What are the three standard I/O streams and what purposes do they fulfill?
Q7) Explain how you would use a Timer to create animation in a JLabel.
To view all questions and flashcards withPage 13 click on the resource link above.
answers,
Chapter 12: Recursion
Available Study Resources on Quizplus for this Chatper
68 Verified Questions
68 Flashcards
Source URL: https://quizplus.com/quiz/30671
Sample Questions
Q1) What is the result of calling foo(a, 2, 0);?
A) 0
B) 1
C) 2
D) 3
E) 4
Q3) Write a recursive method called numSegments(int order) that yields the number of
line segments in a Koch snowflake of order "order."
To view all questions and flashcards with answers, click on the resource link above.
Page 14
Chapter 13: Collections
Available Study Resources on Quizplus for this Chatper
68 Verified Questions
68 Flashcards
Source URL: https://quizplus.com/quiz/30672
Sample Questions
Q1) Which of the following criticisms of an array is applicable to a Java array?
A) It is an inefficient structure to access random elements
B) It only supports First-in First-out types of accesses
C) It is fixed in size (static)
D) It cannot be used to create an Abstract Data Type such as a Queue or Stack
E) all of the above
Q2) Abstract Data Types have which of the following object-oriented features?
A) information hiding
B) inheritance
C) polymorphism
D) message passing
E) all of the above
Q3) A Stack s stores int values. Show what s will look like after each of the following
instructions is executed.
To view all questions and flashcards withPage 15 click on the resource link above.
answers,