You do not have permission to view the full content of this post.Log in or register now.
pa unlock na naman po sana ako.masyado marami homework paps.thanks
We all knew that college is so hard but it is harder ngayin kasi pandemic. Ang hirap pag online class tbh. Gusto ko sana maka sabit sa chegg idol. Promise hindi ko po e chechange password mamatay man o dikaya mapunta sa empyerno if echechange ko. I need it talaga for class huhuhu Salamat
0
2,822 answers 1.True or False:
(a) A sequence of 0s and 1s is called a decimal code. : FALSE . BINARY CODE
(b) ZB stands for zero byte. FALSE , ZETTA BYTE
(c) The CPU stands for command performing unit. FALSE , CENTRAL PROCESSING UNIT
(d) Every Java application program has a method called main. TRUE, MAIN IS STARTING POINT OF EXECUTION
(e) An identier can be any sequence of digits and letters. FALSE, FIRST CHARACTER SHOULD BE UNDERSCORE OR ALPHABET
(f) Every line in a program must end with a semicolon. TRUE
2. Explain the two most important benets of the Java language
ANS:
I)Java is platform-independent.
The ability to run the same program on many different systems is crucial to World Wide Web software, and Java succeeds at this by being platform-independent at both the source and binary levels.
II) Java is object-oriented.
This allows you to create modular programs and reusable code.
3 Explain the dierences between machine languages and high-level languages?
1.
high-level languages
It is programmer friendly language.
machine languages a
It is a machine friendly language.
3.
High level language is less memory efficient.
Low level language is high memory efficient.
4.
It is easy to understand.
It is tough to understand.
5.
It is simple to debug.
It is complex to debug comparatively.
4. Explain the dierence between a keyword and a user-dened identier?
Keywords are predefined reserved words, which possess special meaning. Each keyword defines the “type” declared data. Keywords should not be used as identifiers.EX int char double
An identifier is a unique name given to a particular variable, function or label of class in the program. To create a variable, both a keyword and an identifier are bind together. ex int num
5 Are the identifiers rstName and FirstName the same?
No Java is Case sensitive. there are not the same for java
Qn2 Which of the following are valid Java identiers?
(a) myFirstProgram (b) MIX-UP (c) JavaProgram2
(d) quiz7 (e) ProgrammingLecture2 (f) 1footEquals12Inches
(g) Mike'sFirstAttempt (h) Update Grade (i) 4th
(j) New Student
valid: a,c,d,e,i
invalid: b,f,g,h,j
Rules:
Each identifier must have at least one character.
The first character must be picked from: alpha, underscore, or dollar sign. The first character can not be a digit.
The rest of the characters (besides the first) can be from: alpha, digit, underscore, or dollar sign. In other words, it can be any valid identifier character.
Qn3 The following program has syntax errors. Correct them. On each
successive line, assume that any preceding error has been corrected. After you have
corrected the syntax errors, type and compile the program to check if all errors have
been found.
public class Qn3
{
static final int SECRET_NUM = 11 ,213;
static final PAY_RATE = 18.35
public void main ( String [] arg)
{
int one , two;
double first , second
one = 18;
two = 11;
first = 25;
second = first * three ;
second = 2 * SECRET_NUM ;
SECRET_NUM = SECRET_NUM + 3
System .out. println ( first + " " + second + " "
+ SECRET_NUM );
paycheck = hoursWorked * PAY_RATE
System .out. println (" Wages = " paycheck );
}
}
Ans:
/* CORRECTION AND ASSUMING RANDOM VALUE TO NOT INITIATED VARIABLE */
public class Qn3
{
static int SECRET_NUM = 11;
static final int three = 213;
static final double PAY_RATE = 18.35;
public static void main ( String [] arg)
{
int one , two,hoursWorked = 2;
double first , second;
one = 18;
two = 11;
first = 25;
second = first * three ;
second = 2 * SECRET_NUM ;
SECRET_NUM = SECRET_NUM + 3;
System .out. println ( first + " " + second + " "
+ SECRET_NUM );
double paycheck = hoursWorked * PAY_RATE;
System .out. println (" Wages = " +paycheck );
}
}
/* OUTPUT */
run:
25.0 22.0 14
Wages = 36.7
Qn 4 )Write a program that prompts the user to input ve decimal numbers.
The program should then add the ve decimal numbers, convert the sum to the
nearest integer, and print the result.
Screen shot of the output:
#include <iostream>
using namespace std;
double a, b , c , d , e, f;
int main(int argc, char* argv[])
{
cout << "enter 5 decimals: " << endl;
cin >> a >> b >> c >> d >> e;
f = a + b + c + d + e;
cout << static_cast<int> (f + .5)<< endl;
return 0;
} You do not have permission to view the full content of this post.Log in or register now.