LESSON 3 - SYNTAX, ERRORS AND DEBUGGING

Similar documents
Chapter 2: Elements of Java

Java Basics: Data Types, Variables, and Loops

Chapter One Introduction to Programming

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Java Interview Questions and Answers

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Moving from CS 61A Scheme to CS 61B Java

The C Programming Language course syllabus associate level

Variables, Constants, and Data Types

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Introduction to Java. CS 3: Computer Programming in Java

Computer Programming I & II*

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

Pemrograman Dasar. Basic Elements Of Java

Sources: On the Web: Slides will be available on:

C++ INTERVIEW QUESTIONS

C++ Language Tutorial

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

CS 106 Introduction to Computer Science I

Java Crash Course Part I

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Chapter 3. Input and output. 3.1 The System class

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Chapter 7D The Java Virtual Machine

Chapter 2 Elementary Programming

Semantic Analysis: Types and Type Checking

Scanner sc = new Scanner(System.in); // scanner for the keyboard. Scanner sc = new Scanner(System.in); // scanner for the keyboard

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

JavaScript: Introduction to Scripting Pearson Education, Inc. All rights reserved.

Facebook Twitter YouTube Google Plus Website

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

VB.NET Programming Fundamentals

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

CS506 Web Design and Development Solved Online Quiz No. 01

Introduction to Python

Some Scanner Class Methods

Lab Experience 17. Programming Language Translation

Introduction to Java

Outline Basic concepts of Python language

Introduction to Data Structures

Introduction to Python

Java (12 Weeks) Introduction to Java Programming Language

AP Computer Science Java Subset

Java Cheatsheet. Tim Coppieters Laure Philips Elisa Gonzalez Boix

Chapter 13 - The Preprocessor

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

VHDL Test Bench Tutorial

Install Java Development Kit (JDK) 1.8

Introduction. Why (GIS) Programming? Streamline routine/repetitive procedures Implement new algorithms Customize user applications

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

Programming languages C

#820 Computer Programming 1A

Object Oriented Software Design

Database Programming with PL/SQL: Learning Objectives

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

Part I. Multiple Choice Questions (2 points each):

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

Object Oriented Software Design

3.GETTING STARTED WITH ORACLE8i

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

arrays C Programming Language - Arrays

Java Types and Enums. Nathaniel Osgood MIT April 25, 2012

Information and Computer Science Department ICS 324 Database Systems Lab#11 SQL-Basic Query

Introduction to Visual C++.NET Programming. Using.NET Environment

Contents. 9-1 Copyright (c) N. Afshartous

Computer Programming I

ExamView Dynamic Questions Training Guide for PC and Mac Users

Chapter 2 Introduction to Java programming

Programming and Software Development CTAG Alignments

Chapter 5 Names, Bindings, Type Checking, and Scopes

Java Programming Fundamentals

Stacks. Linear data structures

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

7.1 Our Current Model

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

C PROGRAMMING FOR MATHEMATICAL COMPUTING

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Lecture 9. Semantic Analysis Scoping and Symbol Table

So far we have considered only numeric processing, i.e. processing of numeric data represented

Java CPD (I) Frans Coenen Department of Computer Science

Instruction Set Architecture (ISA)

Chapter 1 Java Program Design and Development

Computer Programming I

Third AP Edition. Object-Oriented Programming and Data Structures. Maria Litvin. Gary Litvin. Phillips Academy, Andover, Massachusetts

Java Interfaces. Recall: A List Interface. Another Java Interface Example. Interface Notes. Why an interface construct? Interfaces & Java Types

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. CSC467 Compilers and Interpreters Fall Semester, 2005

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Third Edition

CS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java

Stack Allocation. Run-Time Data Structures. Static Structures

SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova

Transcription:

LESSON 3 - SYNTAX, ERRORS AND DEBUGGING FILL IN THE BLANKS Complete the following sentences by writing the word or words in the blanks provided. 1. The set of all the words and symbols of a language is called the of the language. 2. A programming language varies from a natural language in three ways, size,, and literalness. 3. The Java programming language has a total of numeric data types. 4. Java's double floating-point data type requires bytes of storage. 5. An item in a program whose value can change during program execution is called a(n). 6. An arithmetic in Java consists of operands and operators combined in a manner similar to algebra. 7. A program statement that divides an integer value by a floating-point value is using arithmetic. 8. Java's String data type is a member of the data type category. 9. The method can be used to determine the current size of a String object. 10. Multi-line comments can be created in Java programs by opening and closing the block of text with the symbols and. 11. Sending a message to a variable before the corresponding object has been instantiated will cause a exception. TRUE/FALSE Circle T if the statement is true or F if the statement is false. T F 1. Java's syntax consists of the rules for combining words and symbols into a program statement. T F 2. Programming languages are much more complex than human languages. T F 3. Java's int data type requires 2 bytes of storage. T F 4. In Java, the String data type is one of the primitive data types. T F 5. When defining a variable in Java, you must always declare the variable's data type. T F 6. Unlike other programming languages, Java does not allow the use of parentheses to override the order of evaluation in an expression. T F 7. Java's modulus operator returns the value of the remainder in a divide operation. T F 8. Two string variables can be combined into one string variable by concatenating the strings. T F 9. All methods for Java objects are required to return some type of value to the calling routine. T F 10. Attempting to use a variable before it is declared will result in a run-time error when the program is run.

T F 11. Logic errors in a program are commonly referred to as bugs. MULTIPLE CHOICE Select the best response for the following statements. 1. Which of the following terms defines the rules for interpreting the meaning of a program statement? a. syntax. b. vocabulary. c. semantics. d. de-coding. 2. Which of the following options defines the category that Java's integer and floating-point data types belong to? a. intrinsic. b. primitive. c. object. d. numeric. 3. What is the maximum positive value that can be stored in a Java variable of type int? a. 32,755. b. 1,073,741,824. c. 2,147,483,647. d. 4,294,967,294. 4. What name is given to items in a program whose value does not change during program execution? a. literals. b. statics. c. fixed-variables. d. none of the above. 5. Which of the following statements shows the correct syntax for declaring a variable named alpha, of data type double? a. alpha = double;. b. alpha(double);. c. double(alpha);. d. double alpha;. 6. Which of the following keywords is used to declare a variable as a constant in a Java program? a. constant. b. final. c. literal. d. static. 7. A variable of one data type can be temporarily converted to a different data type to perform a calculation by using which of the following methods? a. casting. b. promotion. c. conversion. d. type-swapping.

8. What symbol does Java use to represent the escape character? a. /. b. ~. c. %. d. \. 9. What term is used in Java to refer to a class or a group of classes that are combined and imported into a Java program via the import statement? a. user-library. b. a package. c. a header file. d. an object set. 10. Which error type listed below cannot be automatically detected by a programming environment? a. syntax. b. run-time. c. logic. d. none of the above. 11. What type of error will occur if a program attempts to do an integer division by zero? a. logic. b. run-time. c. syntax. d. null pointer. WRITTEN QUESTIONS Write your answers to the following questions. 1. Describe the difference between the vocabulary, syntax, and semantics of a programming language. 2. What are the two categories of data types in the Java programming language? Give an example of which data types exist in each of the two categories.

3. Explain the difference between a literal and a variable. Provide one or two code statements to illustrate the difference. 4. What is required to define a variable in the Java language? Provide at least two programming statements defining variables of different data types. 5. What is meant by the term mixed-mode arithmetic? What can be done to avoid problems that could arise out of using mixed-mode arithmetic? 6. Explain the process of string concatenation. What would be the results of concatenating the following expressions? "My value is " + 3 + 4+ 5 "My value is " + 3 + (4 + 5) "My value is " + (3 + (4 * 5) "My value is " + 3 * 4

7. What is the difference between a method, a message, and a signature? 8. What is a package, and why and how is it used? 9. Give a brief description of the difference between syntax errors, run-time errors, and logic errors.