Trending ▼   ResFinder  

computer notes

9 pages, 10 questions, 3 questions with responses, 5 total responses,    5    0
Pranayak Uniyal
City Montessori School (CMS Aliganj Campus I), Lucknow
+Fave Message
 Home > pranayak >

Formatting page ...

Definitions Abstraction : it is the act of representing essential features and hiding the background details. Encapsulation: it is an act of wrapping of the data and function as one single unit. Provides insulation of the data from the direct access by the program . Inheritance : it is the capability of one class to inherit the properties from another class Polymorphism: it is the ability of data to be processed in more than one form Variables A variable is defined as a location in the memory of the computer where the values are stored. (Or) it is a letter or a word used to represent a value Various types of variables: Instance variables, class variables and local variables Scope of a variable: Instance Variable/non static variables : are created when the objects are instantiated and therefore they are associated with the objects. They take in different values for each object. Class Variable/static variable: are local to a class and belong to the entire set of objects that class creates. Only one memory location is created for each class variable. Local variables: variables declared and used inside methods are called local variables. They are called so because they are not available for use outside the method definition. A constant is the value stored in a variable and remains the same during the execution of a program. Operators: a symbol used to depict a mathematical or logical operation. Symbolic constant/ Keyword - Final : Sometimes we might want a variable to behave like a constant. For example the value of pi=3.14. if we add the word final then the variable will behave like a constant. Eg. final float pi=3.14. Arithmetic operators: they provide facilitation to the mathematical calculations within a program: they are + - * / % Assignment operators: These operators are used to assign the value of an expression to a variable : = Shorthand operators : allows ease while programming instructions and feature with all the available operators with two operands : += -= *= /= %= Relational operators: provide facilitation for comparing numbers and characters for calculation and do not function with strings.: > < <= >= == != Increment operator : is used to increment the variable by 1: ++ Logical operators: used to conduct the logical combination of Boolean values within a program.: && || ! Expression : is a combination of operators, constants and variables. Type conversion: conversion of defined type variable into another type. The process of conversion of one data type to another is called casting. Explicit type conversion: The process of converting one predefined type into another is called type conversion it includes conversion of data according to the specification by the user. also called as type casting :eg int x= 65; char c = (char) x; it is called type casting. Implicit type conversion: The process of converting one predefined type into another is called type conversion.It is performed invisible and hence known as automatic conversion. When two operands of different types are encountered in the same expression the lower type variable is converted to the type of the higher type variable automatically and is also known as type promotion.: byte x=8; int y=x; it is called coercion. Ternary operator: Excellent substitute to the control statement like if statement. syntax: value variable = (test expression): expression 1: expression 2; it the test expression is true then the variable takes expression 1 as its value whereas if it is false then it takes expression2. Final: The keyword final makes a variable as constant. i.e. whose value can not be changed during the program execution 1 Dynamic initialization: it is an expression that initializes a variable during runtime; Eg: int a= c * b; Name any 2 control statements of java: Selection control statement and iteration control statement. Selection control statement is also called decision statement. They are simple if, if-else, nested if else and nested else if. Iteration statements : They activate the execution of the instructions repeatedly until a given condition is met.: they are for statement, while and do- while statements. While statement is another looping statement and it is entry controlled. The statement will work only if the condition is true. Do-while : It is another looping statement and it is exit controlled. The statement will work once even if the condition is false. Break : it is used as a terminator from the enclosed loop and transfers the control to the statement after the loop. (or) Break : When break statement is executed it comes out of the inner most loop(if it is a loop statement ) and it comes out of a switch-case statement. continue: Causes the control to transfer from within the block to the next iteration of the loop. (or) Continue : when a continue is executed the control skips the rest of the statement for that value and resumes for the next iteration. A method/ function: Is a combination of a group of instructions. A method has the following : a name , return type and optional parameters. Returnable method: returns a value to the function program where the call is given. Non returnable method: There is no return of value to the calling function and it is also called void function program. Visibility labels / access specifiers: Major type are public, private, friendly and protected. Type conversion: The process of converting one predefined type into another is called type conversion. A constructor is a method with the same name as a class. It is invoked automatically every time an object is instantiated. It does not have a return type and it is used to initialize member variables. There are two types : default and parameterized constructors. Default constructors are used to initialize all the variables to a 0 value. Function overloading : Methods with the same name but either a different number of parameters or different types in the parameter list. An array : It is a set of like terms with a common name but with a different subscript no. There are two types of arrays: single and multidimensional Linear search: is used to scan the array in a sequential manner. Under this method the whole array is searched one by one until the matching element is found. Time consuming. The arrary need not be sorted. Binary search: This is a short cut method when compared to linear search. The array should be sorted. Under this initially the comparison is made of the given condition for search with the middle of the concerned array element and if not found there, the searching is then done to the first or the second half. The process continues till the desired element is found. Sorting : Process of arranging a data list in an order (ascending /descending) Compiler : It is a software which converts high level language program to machine language and viz. as a whole. It is faster but hard to debug. Interpreter: It is a software which converts high level language program to machine language and viz line by line. It is slow but easy to debug. Bytecode : When a java source code is compiled the resultant got is called a bytecode. Keywords: These are words have a specific meaning to a language compiler. Tokens: It is the smallest unit of a program Literals : is a token whose value doesnot change during the execution of a program. Comments: Giving remarks for a statement is called as a comment. There are 3 different types of giving a comment. 2 // single line comment /* .. */ multi line comment /** .. */ documentation Jdk Java development kit. Statement : A set of instructions which terminate with a colon are called a statement. Eg. Int a =4; Compound statement / Block statement: Multiline statements are called compound/block statement. They are enclosed in curly brackets { } Eg if(a>b) { a=4; b=0; } Applets: small programs developed for internet applications Package : is a collection of classes. Each package includes related built in functions. Buffer: High speed temporary storage is called a buffer. Syntax errors: These errors result when the rules / grammar of the programming language are not followed. Eg. int a=4.3; Logical errors: It is an error in the planning or the program s logic. The computer does not detect it Eg. for(int i=0;i>=5;i++) Runtime error: These errors occur due to some mistake other than syntax or logical error. It is an execution error. Eg. division by zero. int a=6 ,b=0; int c=a/b; Iteration : A set of statements repeated until a condition is satisified. User defined data type: a class created by the user is known as user defined data type. Wrapper class : It wraps the primitive data values in object. It is a member of java library Java.Lang. User defined Packages: A package defined by the users to be used in various program logic are known as user defined packages. Eg. Package area: class rectangle { . } class square { .. .. } the package name is area. All the classes within it are the members of area packages. Exception : Unexpected situation may appear due to Arrays: It is a set of like terms which are referred to by a common name but a different subscript. Pure function: It is also called accessor method as it doesn t change the state of an object. A pure function returns a value to the calling prog Impure function: An impure function may not return a value. It basically changes the state of an object each time. It also is called a mutator. Pass by value : is the process of passing a copy of actual arguments to the formal parameters. Any change made in the formal parameters does not reflect on the actual argument. Pass by reference: is the process of passing the reference of actual arguments to the formal parameters and any change made in the formal parameters will be reflected on the actual arguments. Function overloading: is the process of defining functions/methods with the same function names but with different number and types of parameters 3 Static binding: while doing function overloading it finds the best match of the function arguments and the parameter list( types and number of parameters) during program compilation. This phenomenon is termed as static binding. Recursive function: A function designed in such a way that it calls itself in its body is called recursive function. Private: the data members or member methods which are specified as private can be used only within the scope of the class. These members are not accessed outside the class. Public: The class members specified as public can be used even outside the visibility of a a class Protected: the protected members are used in the class as private members which can only be applied within the class but can be inherited to another class Constructor: is a member function with a name same as that of the class name and used to initialize the instant variables of the objects There are 2 types of constructors: Default and parameterized constructor Parameterised constructor:A parameterized constructor is a member function with same name as the class name which is used to initialize the object variable Function Definition: consists of the access specifier, modifier, return type , function name( parameter list) Function signature: refers to the number and types of arguments Function prototype: is the first line of the function definition that tells the program about the type of the value returned by the function and the number and type of arguments Static: it means the method is not called through an instance of a class but rather, through the class itself. Input stream: A source of input data is called an input Stream Exception handling: it is a way of handling anomalous situations in a program-ru Compile-time error: these are errors resulting out of violation of programming language s grammar rules. Eg: writing syntactically incorrect statements : System.out.println a test ; Runtime errors : errors that occur during the runtime because of unexpected situations. throws: is used to inform that an error has occurred. Finally : it is a block of code that is always performed regardless of whether an exception is signaled or not Character class: whose instance or objects can hold single character data. String class: whose instance or objects can hold unchanging string(immutable strings) ie. Once initialized it cannot be modified. String buffer: whose instance or objects can hold(mutable strings that can be changed or modified. Array: it is a set of like terms that have a common name but a different subscript no. Public: which means that anyone can call this method and also called service methods. Private: which means that only the methods in the same class are permitted to use in this method., not by inheritors and not by other packages Protected: which means that methods in this class and methods in any subclasses may use this method( that inherit the class)and also to all the classes in the package Composite data type: the data type that are based on fundamental or primitive data types, they are also called as user defined data types this keyword: this pointer stores the address of currently calling object Selection statement: These are statements which allows to choose a set of instructions for execution depending upon an expression return statement:used to return a value from a function to the calling program Dynamic Binding: Message passing when the objects need to interact with one another, they pass /request information to one another. This interaction is known as message passing. Object factory producer of objects rvalue - the data that is stored in the memory lvalue the address of the memory location where data is stored. final is a keyword which makes a variable declaration as constant. Instanceof operator tests whether its first operand is an instance of its second. Operator precedence determines the order in which expressions are evaluated. 4 Block is a group of zero or more statements between balanced braces and can be used anywhere a single statement is allowed. What is the basis of all computation in java? Class A function prototype is the first line of the function definition return causes a immediate exit from the function. U can return only one value temporary instance of a class it is an anonymous object of the class and which is shortlived. Advantage is avoiding unnecessary wastage of spaced. Datas that are based on fundamental or primitive datatypes are called composite datatype. Heap memory- it is a memory pool that is managed by java, where the java interpreter creates objects dynamically. Accessor method is a method that returns the value of a data member of the class. And it is often referred to as getter methods. Setter method is a method that sets/charges the value of a data member of the class. Stream flow of data. Source of input data is called input stream and output data is called output stream. System.in is a object of InputStream and is automatically created and connected to the keyboard by the System class. finally it is used to provide a block of code that is always performed regardless of whether an exception is signaled or not. throw it is a keyword that is used to force an exception. throws is used to inform that an error has occurred. Scope region within which a variable or a piece of code is accessible. Destructor is a member method that gets invoked when the object scope ends. this( ) function inside a constructor calls another constructor of the same class this keyword refers the object currently invoking a member function Recursive method : a Function calls itself Buffered Reader a class that supports buffered input stream InputStreamReader a sub class that converts bytes to characters StringTokenizer converts a string of text into its tokens Converting other data types to string type value of Eg String valueOf(num); A package that is invoked by default -java.lang A keyword to use the classes defined in a package import Name the 2 different types of packages user defined and API packages An interface is a set of variables and methods like a class. Diff between class and interface a class defines the methods in its body and declares the variables. An interface defines only abstract methods and final fields. Similarity between class and interface both contains methods and variables. Abstract method All methods in an interface are abstract, (ie) their body needs to be defined in a class that implement the interface. Extends keyword - is used by a class to the features and methods of a class. Base class is also called super class An accessor method is a method that returns the value of a data member of the class. Mostly accessor methods are provided for private members. It is also referred to as getter method A setter method/ mutator method is a method that sets/ changes the value of a data member of the class. Constructor get called when object of the class is created. Class variable which is available to the entire class. Blue J is a Java development environment. It is an IDE which includes an editor debugger and a viewer. Difference a) Break & continue Break it serves as a terminator from the enclosed loop,(i.e) it comes out of a inner loop. And transfers the control to the statement after the loop. Continue Continue-causes the control to transfer from within the block to the next iteration of the loop. Break Eg. While(amount<100) Eg. for(i=0;i<5;i++) 5 { if(amount = = 11) break; } if amount is 11 then the control will be transferred to the statement following the while loop. { if(a= =0) continue; System.out.println(a*a); b) = & = = = = is an assignment operator, used to assign values to a variable = = = = is a relational operator, used to check for equality eg. a=4; if(a = = 5) c) Variables & constant A variable is defined as a location in the memory of the computer where the value is stored. A constant is the value which is stored in a variable Eg: a, amount Ida 37 P.S.M. st d) Pre increment and post increment both increment the value by 1. Pre increment Prefix the variable gets incremented first and then use. Post increment post increment is incremented after the operation of function of its associate operator, Whereas Eg. a=4; a+=++a; =9 a+=a++; = 8 e) & and && & is a bitwise operator ( for the manipulation of data at the bit level) && is a logical operator( the logical operator evaluates to true value if either of the 2 expressions is true. f)Implicit Type conversion & Explicit type conversion implicit Explicit Is a conversion of one data type into It is user defined that forces an expression another by the compiler without the user s to be of specific type intervention Implicit Eg. float a=4.5f; double int x=66; x=987.9998; char c=(char)x; If any operation is done using the above data types then the resultant will be double. g) do-while and while statement Do while Exit controlled If the condition is false then also the loop will be done once Eg.: int a=1; While (a>=5) { while Entry controlled If the condition is false then the loop will not be done at all int a=1; do { 6 a++; } loop will not be done even once a++; }while(a>=5); loop will be done at least once h) Expression and operators Expression Expression is a combination of operators, constants and variables. It can be arithmetic, relational etc. Eg : u+1/2 at2 Operators Operators : it is a symbol used to represent logical or arithmetic operations Eg : + - * / % i) unary operator & binary operator unary operator 1 operator 1 operand eg. 4 binary operator 1 operator 2 operands eg : 2+4 j) to Uppercase & to Lowercase to Uppercase is used to convert all the characters of a string into capitals to Lowercase is used to convert all the characters of a string into small letters. Eg String a= Hello ; String b = a.toUppercase() HELLO String c= a.toLowercase() hello k) if else- switch case If else All the different data types can be used Does not have a default operation Can be tested for logical and relational fn Switch case Only char and int type can be used Has a default operation Only for equality l)Testing and Debugging Testing Debugging Testing is the process in which a program is Debugging is a process in which the errors validated in the program are removed m)Primitive data types and wrapper class Primitive data types Are written in lower case letters Wrapper class The first letter is always in capital letters n) / and % / Returns the quotient Eg: int c=7/2 answer =3 float c=7/2 answer = 3.5 % Returns the remainder Eg: int c=7%2 Answer =1 o) compareTo and equalsTo compareTo Compares two strings and returns either 1,1 or 0 equalsTo Returns true or false p)public, private and protected Public private Accessible by : Accessible by: Classes in the same package Classes in other packages Not accessible: Subclasses in the same by classes in the same package package Subclass in the other by classes in other packages packages by subclasses in the same 7 protected Accessible by: Classes in the same package By subclasses in the same package Subclasses in other packages Not accessible: package by other subclasses in other packages q)Compiler and interpreter compiler It is a software which converts high level language into machine language as a whole By classes in other packages It is faster Debugging is harder Interpreter It is a software which converts high level language into machine language line by line Slower Debugging is easier r) character and string literal Character literal A single character enclosed within single quotes String literal Zero or more characters enclosed within double quotation. s) primitive and user defined datatype Primitive data type These are built in data types The sizes of these objects are fixed User defined data type Created by user The sizes of these data types depend upon their constituent members These data types are available in all parts of The availability of these data types depends a java program upon their scope t)global and local variable Global variable Class variable which is available to the entire class Local variable Variable declared inside a method or block ,available only inside a block. u)for and while For Can be used for only fixed iteration Can use only char or int type while Can be used when the no of times for a loop to be done is not known Any data type v) Actual parameter and formal parameter Actual parameter It is found in the calling statement Formal parameter Found in the function prototype w) Binary search : is used to scan the array in a sequential manner. Under this method the whole array is searched one by one until the matching element is found. Under this initially the comparison is made of the given condition for search with the middle of the concerned array element and if not found there, the searching is then done to the first or the second half. The process continues till the desired element is found. . The arrary need not be sorted. Time consuming The array should be sorted. : This is a short cut method when compared to linear search. x)POP and OOPs Emphasis is on the function Use top down approach Not suitable to solve complex problems in real situation Gives equal emphasis on data and functions Modular approach Can be used y)length and length() 8 To find the length of the array arr={2,4,6} arr.length=3 To find length of the string Str= IDA SCUDDER Int l=str.length(); l=11 z)Pure and impure Is the one that takes object and /or primitives as arguments but does not modify the objects Changes/modifies the state of the received object A1)Actual parameter and formal parameter Appears in the function call statement Appear in the function definition A2)call by value and call by reference The copy of the values get passed to the called method and the changes in the values are not reflected back to the calling method It receives a reference to the passed parameters and through this reference, it accesses the original data. Any changes that take place are reflected in the original data. Uses anobject Uses primitive data type A3) Constructors and method Creates an instance of a class Has no return type not even void Called at the time of object creation Group of java statements Void or any valid data type Called when a function call for the specific method is encountered. A4) Byte oriented IO & character oriented It can read any datatype with them Uses data input stream & data output stream A5) String and String buffer Uses character encoding scheme Uses reader and writer 9

Formatting page ...

Formatting page ...

Top Contributors
to this ResPaper
(answers/comments)


Sahil Chordia

(1)

Siddhi K.

(1)

Yesha Kadakia

(1)

ResPaper Admins

(1)

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 


© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

pranayak chat