B.V. Patel Institute of BMC & IT, UTU 2014

Similar documents
CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

Full file at

Lecture Set 2: Starting Java

Lecture Set 2: Starting Java

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

CONTENTS: Compilation Data and Expressions COMP 202. More on Chapter 2

Getting started with Java

PROGRAMMING FUNDAMENTALS

Section 2: Introduction to Java. Historical note

2 rd class Department of Programming. OOP with Java Programming

Programming with Java

JAVA Programming Fundamentals

Lecture 2 Tao Wang 1

Computational Expression

Chapter. Let's explore some other fundamental programming concepts

CS11 Java. Fall Lecture 1

A variable is a name for a location in memory A variable must be declared

Chapter 2: Data and Expressions

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

Course Outline. Introduction to java

Chapter 2: Using Data

Introduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

Section 2.2 Your First Program in Java: Printing a Line of Text

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

ECE 122 Engineering Problem Solving with Java

INDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line

Lecture Notes. System.out.println( Circle radius: + radius + area: + area); radius radius area area value

Character Stream : It provides a convenient means for handling input and output of characters.

CSc Introduction to Computing

Full file at

Section 2.2 Your First Program in Java: Printing a Line of Text

Chapter 02: Using Data

Programming. Syntax and Semantics

Primitive Types. Four integer types: Two floating-point types: One character type: One boolean type: byte short int (most common) long

Lecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University

Chapter 2: Data and Expressions

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Java Overview An introduction to the Java Programming Language

Full file at

Program Fundamentals

Chapter 2, Part I Introduction to C Programming

COMP 202 Java in one week

4. Inputting data or messages to a function is called passing data to the function.

Java Fall 2018 Margaret Reid-Miller

For the course, we will be using JCreator as the IDE (Integrated Development Environment).

CMSC131. Introduction to your Introduction to Java. Why Java?

Zheng-Liang Lu Java Programming 45 / 79

Chapter 2 Elementary Programming

Chapter 2: Data and Expressions

Chapter 2: Using Data

CS313D: ADVANCED PROGRAMMING LANGUAGE

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators,

Variables, Constants, and Data Types

Programming in C++ 4. The lexical basis of C++

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

The Warhol Language Reference Manual

Pace University. Fundamental Concepts of CS121 1

Java Notes. 10th ICSE. Saravanan Ganesh

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Exercise: Using Numbers

Introduction to Java Applications; Input/Output and Operators

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Tools : The Java Compiler. The Java Interpreter. The Java Debugger

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

Java Primer 1: Types, Classes and Operators

Primitive Data Types: Intro

Basic Operations jgrasp debugger Writing Programs & Checkstyle

ESc101 : Fundamental of Computing

First Java Program - Output to the Screen

Java Programming Fundamentals. Visit for more.

4 Programming Fundamentals. Introduction to Programming 1 1

An overview of Java, Data types and variables

Fundamentals of Programming. By Budditha Hettige

ARG! Language Reference Manual

Entry Point of Execution: the main Method. Elementary Programming. Learning Outcomes. Development Process

Programming Language Basics

II. Compiling and launching from Command-Line, IDE A simple JAVA program

Chapter 2: Basic Elements of Java

Objectives. In this chapter, you will:

Basics of Java Programming

Chapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz

Chapter 2 ELEMENTARY PROGRAMMING

Tester vs. Controller. Elementary Programming. Learning Outcomes. Compile Time vs. Run Time

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

Basics of Programming

Unit 4. Input/Output Functions

Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

What did we talk about last time? Examples switch statements

Elementary Programming

We now start exploring some key elements of the Java programming language and ways of performing I/O

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

Formatted Output Pearson Education, Inc. All rights reserved.

Visual C# Instructor s Manual Table of Contents

CMPT 125: Lecture 3 Data and Expressions

Transcription:

BCA 3 rd Semester 030010301 - Java Programming Unit-1(Java Platform and Programming Elements) Q-1 Answer the following question in short. [1 Mark each] 1. Who is known as creator of JAVA? 2. Why do we need an escape sequence? 3. List out one difference between next() and nextline(). 4. What is Narrowing Conversion? 5. Why is Java Application Programming Interface used? 6. State the term Boxing & Unboxing. 7. What is the purpose of println(),printf(),print() methods. 8. Which operator is used to concatenate two string constant? 9. What do you mean by side effect? State it by giving a proper example. 10. What will be the output of the following line of code: System.out.printf("1/3=%d\n",1/3); 11. What will be the range of floating types in Java Programming? 12. What is the number of bytes used by Java primitive Integral types? 13. Define mixed mode operation with an example. Q-2 Answer the following question. [ 2-3 Marks each] 1. Describe four features of Java. 2. Discuss four differences between C++ and Java. 3. Explain with example how an instance becomes eligible for garbage collection. 4. How do we specify integer constants? Specify the three different ways of specifying an integer constant. 5. Give one key difference between character and string literal? Give one example. 6. Write an interactive program to check whether a given number is an Armstrong number or not. 7. How Java is an object oriented programming language? 8. Differentiate JRE & JVM. Give at least four points. 9. Justify statement for Java- Write once; run anywhere any time. 10. Why do we only use main() method to start a program? 11. Which is the stream concept used for I/O operations in Java? Explain with example. 12. How is lexical analysis performed? Which are the entities identified during analysis? 13. What is binding? Explain types of binding supported in Java. 14. What is operator precedence? Arrange the following operators in the order of their precedence : -, *, +,(),^,!,++,--,,,&,/,&& Q-3 Select most appropriate answer from the given option. [1 Mark each]. 1. What is literal in Java programming? a. Source code representation of fixed value. b. Special type of class. c. Special type of data type. d. None of these. 2. should be the value of y after execution of the following statements. int x = 10, y ; x+=++x; y = x--; Ms.Jenisha Tailor, Ms. Jaishri Patil Page 1

a. 12 b. 21 c. 20 d. None of the above. 3. An integer literal is of type long if and only if it has suffix- in Java programming. a. D b. F c. L d. O 4. What should be the output of following statements? String str = new String( Java Platform ); char c = str.charat(-1); System.out.println(c); a. Print value of c variable. b. Give compile time error. c. Give run time error. d. Print blank character. e. None of the above. 5. Which one of the following is a valid comment in Java? a. /*This is a comment **/ b. /** This is a comment */ c. /Comment d. All of the above. 6. is virtual CPU that is simulated by a program to run on the actual CPU. a. JRE b. JDK c. JVM d. JIT 7. Which of following select the portion of byte code and compile into executable code in real time? a. JRE b. JDK c. JVM d. JIT 8. Which of the following application model facilitates the implementation of services as multitier application through well define component? a. J2ME b. J2SE c. J2EE d. JDK 9. Which of the following is not a graphic character? a. Digit b. Symbol c. Enter d. Blank space 10. Which escape sequence is use to moves cursor to the first column of current line? a. \\r b. \cr Ms.Jenisha Tailor, Ms. Jaishri Patil Page 2

c. \r d. \n 11. Which of the following is Reference data type? a. String b. byte c. int d. long 12. Which of the following syntax is not true for the argument passed to main() method? a. String []args b. String args[] c. String args d. None of the above. 13. Which of the following compiler of JVM cached native machine code when the method is first time call? a. JIT b. HotSpot Compiler c. Adaptive optimizer d. Interpreter 14. In Java which of the following is use for 32- bit Unicode encoding? a. UTF 32 b. Unicode -32 c. ASCII d. UTF 16 15. Which of the following is considered as individual unit of program by Java compiler? a. White space b. Literals c. Keyword d. Tokens 16. Which of the following is a graphic character? a. Symbol b. Enter c. Backspace d. Tab 17. What should be the data type of ans variable name which stores result without truncation, if short s = 2000; byte b = 30; ans = s * b; a. short b. int c. byte d. Byte 18. Which of the following statement is invalid in Java? a. System.out.printf(); b. System.out.print(); c. System.out.print; d. System.out.println(); Ms.Jenisha Tailor, Ms. Jaishri Patil Page 3

Q-4 Fill in the blank. [1 Mark each]. 1. The Java interpreter translates a Java program from to machine language. 2. Another term for is data hiding. 3. A(n) is a set of instructions that tells the basic strategy for solving a problem. 4. means that two or more methods can have different names in the same way that an English word can have two or more meanings. 5. In Java, a library of classes is called. 6. Every variable in Java must be before it is used. 7. An assignment statement always has a single on the left side of the assignment operator. 8. A(n) is used to change the type of a value. 9. was the name of the web browser written entirely in Java. 10. was the name of team that was developing Java initially. 11. is used to compile and to run Java program. 12. The command line arguments in Java application are available as an instance of. 13. To optimize the execution of the Java bytecode, the JVM uses a compiler. 14. object represent standard output stream in Java. 15. Keyboard is linked with the for easier way of writing Java program. 16. The grammar of Java defines both grammar and grammar. 17. A compiler always treats a as a starting character of an escape sequence. 18. Double quote can be express using escape sequence in Java as. 19. Backslash can be expressed using escape sequence in Java as. 20. Converting values of primitive type to corresponding value of reference type is called. 21. Java uses character set to represent text data. 22. The number of exponent bit in float data type is. 23. can be assigned to a reference variable to make the variable to stop referring to any instance. 24. The calculation of 13%5 = 25. The result of adding 2 byte value will be of type. 26. Precision loss can occur when converting a value to type double. 27. Suppose after the following execution, the x will be. String x = 7 ; X+= 8 ; Q-5 State True or False with justification. [1 Mark each] 1. Ice-cream is an illegal identifier in Java. 2. In Java, the double equal sign means "make equal to". 3. System.out is an example of a method. 4. The computer will not print an error message when a logic error occurs. 5. The Java compiler translates Java programs into machine language programs. 6. Java is a high-level language. 7. An upper-case letter is considered to be the same character as a lower-case letter in Java. 8. Java is a programming language meant for use on web only. 9. Java consists of three editions including Standard Edition, Enterprise Edition, and Micro Ms.Jenisha Tailor, Ms. Jaishri Patil Page 4

Edition. 10. JVM accepts to run both.class file and.java file. 11. Platform independent language can run on variety of CPU. 12. Each class defined in Java is compiled into a separate class file whose name matches the class name. 13. A Single Java file may contain any number of classes with the main() method. 14. Applications are executed by using the class name that contains the applications main() method. 15. A byte in Java has 4-bit signed, a short has 8-bit signed. 16. The following definition means X has a string value of \. String X = \. 17. The operator ++ and -- have side effect, it will generate different result depending on the left and right position around variable. 18. Command line arguments may be passed to the Java application, which are available in the main method using its String[] parameter. 19. The size of char data type is 1 byte. 20. Java uses ASCII character set of the char data type. 21. The size of long is 4 byte. 22. A bool value can be cast to an int. 23. JRE does not include Java compiler. 24. The type void is not a type in Java. 25. Suppose X = 10, then X<<1=100 and X>>1=1. 26.? Operator needs three operands. 27. The JVM is an interpreter that takes Java files and generates byte code. Q- 6 Answer the following question in detail. [4 Marks each] 1. Explain Architecture of Java virtual machine (JVM). 2. Explain key components of Java platform. 3. Explain each keyword used in main() method. 4. Explain role of JVM. 5. How Java program execute? 6. Explain memory management in Java. 7. What is type conversion? How it is differ from type casting? Explain. 8. Which class is used to take input from user? Explain with proper example. Ms.Jenisha Tailor, Ms. Jaishri Patil Page 5