The document discusses key concepts in Java programming including:
1) Computers process data under programs called instructions and Java programs are compiled into bytecode files.
2) The main components of a computer are the input, output, memory, CPU, and storage units.
3) Java programs use classes, objects, methods and strings to create applications with control structures, arrays, and collections.
4) Methods, variables, arrays, and objects are defined and used in Java code. Control structures like if/else and loops are also discussed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
44 views
CCE-121 Assignment (Gaps)
The document discusses key concepts in Java programming including:
1) Computers process data under programs called instructions and Java programs are compiled into bytecode files.
2) The main components of a computer are the input, output, memory, CPU, and storage units.
3) Java programs use classes, objects, methods and strings to create applications with control structures, arrays, and collections.
4) Methods, variables, arrays, and objects are defined and used in Java code. Control structures like if/else and loops are also discussed.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9
CCE-121
Exercise: Fill in the blanks
Chapter-1 Introduction to Computers, the internet and Java a) Computers process data under the control of sets of instructions called program. b) The key logical units of the computer are the input unit, output unit, memory unit, central processing unit, arithmetic and logic unit and secondary storage unit. c) The three types of languages discussed in the chapter are machine languages, assembly languages and high-level languages. d) The programs that translate high-level language programs into machine language are called compilers. e) Android is an operating system for mobile devices based on the Linux kernel and Java. f) Release candidate software is generally feature complete, (supposedly) bug free and ready for use by the community. g) The Wii Remote, as well as many smartphones, use an accelerometer which allows the device to respond to motion. h) The java command from the JDK executes a Java application. i) The javac command from the JDK compiles a Java program. j) A Java source code file must end with the java file extension. k) When a Java program is compiled, the file produced by the compiler ends with the class file extension. l) The file produced by the Java compiler contains bytecodes that are executed by the Java Virtual Machine. m) Objects enable the design practice of information hiding although they may know how to communicate with one another across well-defined interfaces, they normally are not allowed to know how other objects are implemented. n) Java programmers concentrate on creating classes, which contain fields and the set of methods that manipulate those fields and provide services to clients. o) The process of analyzing and designing a system from an object-oriented point of view is called object-oriented analysis and design (OOAD). p) A new class of objects can be created conveniently by inheritance —the new class (called the subclass) starts with the characteristics of an existing class (called the superclass), possibly customizing them and adding unique characteristics of its own. q) The Unified Modeling Language is a graphical language that allows people who design software systems to use an industry-standard notation to represent them. r) f) The size, shape, color and weight of an object are considered attributes of the object’s class. Chapter-2 Introduction to Java Applications; Input/Output and Operators a) A left brace ({) begins the body of every method, and a right brace (}) ends the body of every method. b) You can use the if statement to make decisions. c) // begins an end-of-line comment. d) Space characters, newlines and tabs are called white space. e) Keywords are reserved for use by Java. f) Java applications begin execution at method main. g) Methods System.out.print, System.out.println and System.out.printf display information in a command window.
Chapter-3 Introduction to Classes, Objects, Methods and
Strings a) Each class declaration that begins with keyword public must be stored in a file that has exactly the same name as the class and ends with the .java filename extension. b) Keyword class in a class declaration is followed immediately by the class’s name. c) Keyword new requests memory from the system to store an object, then calls the corresponding class’s constructor to initialize the object. d) Each parameter must specify both a type and a name. e) By default, classes that are compiled in the same directory are considered to be in the same package, known as the default package. f) Java provides two primitive types for storing floating-point numbers in memory: float and double. g) Variables of type double represent double-precision floating-point numbers. h) Scanner method nextDouble returns a double value. i) Keyword public is an access modifier. j) Return type void indicates that a method will not return a value. k) Scanner method nextLine reads characters until it encounters a newline character, then returns those characters as a String. l) Class String is in package java.lang. m) An import declaration is not required if you always refer to a class with its fully qualified class name. n) A floating-point number is a number with a decimal point, such as 7.33, 0.0975 or 1000.12345. o) Variables of type float represent single -precision floating- point numbers. p) The format specifier %f is used to output values of type float or double. q) Types in Java are divided into two categories— primitive types and reference types. Chapter-4 Control Statements: Part 1; Assignment, ++ and -- Operators a) All programs can be written in terms of three types of control structures: sequence, selection and repetition. b) The if—else statement is used to execute one action when a condition is true and another when that condition is false. c) Repeating a set of instructions a specific number of times is called counter- controlled (or definite) repetition. d) When it’s not known in advance how many times a set of statements will be repeated, a sentinel, signal, flag or dummy value can be used to terminate the repetition. e) The sequence structure is built into Java; by default, statements execute in the order they appear. f) Instance variables of types char, byte, short, int, long, float and double are all given the value 0 (zero) by default. g) Java is a strongly typed language; it requires all variables to have a type. h) If the increment operator is prefixed to a variable, first the variable is incremented by 1, then its new value is used in the expression. Chapter:5 Control Statements: Part 2; Logical Operators a) Typically, for statements are used for counter-controlled repetition and while statements for sentinel-controlled repetition. b) The do…while statement tests the loop-continuation condition after executing the loop’s body; therefore, the body always executes at least once. c) The switch statement selects among multiple actions based on the possible values of an integer variable or expression, or a String. d) The continue statement, when executed in a repetition statement, skips the remaining statements in the loop body and proceeds with the next iteration of the loop. e) The && (conditional AND) operator can be used to ensure that two conditions are both true before choosing a certain path of execution. f) If the loop-continuation condition in a for header is initially false, the program does not execute the for statement’s body. g) Methods that perform common tasks and do not require objects are called static methods. Chapter-6 Methods: A Deeper Look a) A method is invoked with a method call. b) A variable known only within the method in which it’s declared is called a local variable. c) The return statement in a called method can be used to pass the value of an expression back to the calling method. d) The keyword void indicates that a method does not return a value. e) Data can be added or removed only from the top of a stack. f) Stacks are known as last-in, first-out (LIFO) data structures; the last item pushed (inserted) onto the stack is the first item popped (removed) from the stack. g) The three ways to return control from a called method to a caller are return; or return expression; and or encountering the closing right brace of a method. h) An object of class SecureRandom produces truly random numbers. i) The method-call stack contains the memory for local variables on each invocation of a method during a program’s execution. This data, stored as a portion of the method-call stack, is known as the stack frame or activation record of the method call. j) If there are more method calls than can be stored on the method-call stack, an error known as a stack overflow occurs. k) The scope of a declaration is the portion of a program that can refer to the entity in the declaration by name. l) It’s possible to have several methods with the same name that each operate on different types or numbers of arguments. This feature is called method overloading.
Chapter-7 Arrays and ArrayLists
a) Lists and tables of values can be stored in arrays and collections. b) An array is a group of variables (called elements or components) containing values that all have the same type. c) The enhanced for statement allows you to iterate through an array’s elements without using a counter. d) The number used to refer to a particular array element is called the element’s index (or subscript or position number). e) An array that uses two indices is referred to as a two- dimensional array. f) Use the enhanced for statement for (doubled : numbers) to walk through double array numbers. g) Command-line arguments are stored in an array of strings, called args by convention. h) Use the expression args.length to receive the total number of arguments in a command line. Assume that command- line arguments are stored in String[] args. i) Given the command java MyClass test, the first command- line argument is test. j) An ellipsis(…) in the parameter list of a method indicates that the method can receive a variable number of arguments.
Python Advanced Programming: The Guide to Learn Python Programming. Reference with Exercises and Samples About Dynamical Programming, Multithreading, Multiprocessing, Debugging, Testing and More