Answer:
import java.util.Scanner;
public class UpdateNumberOfUsers {
public static void main (String [] args) {
int numUsers = 0;
int updateDirection = 0;
numUsers = 8;
updateDirection = 1;
if(updateDirection==1){
numUsers++;
}else{
numUsers--;
}
System.out.println("New value is: " + numUsers);
return;
}
}
Explanation:
Conditional statement is the statement which used to check the condition, if condition is TRUE then execute the statement otherwise not execute.
if else is the Conditional statement which used in the programming.
According to question, if updateDirection == 1, then increment numUsers , otherwise decrement.
these are the condition which can put in the if else statement:
if(updateDirection == 1)
{
numUsers++; //increment
}else{
numUsers--; //decrement
}
If we compare the push function of the stack with the insertFirst function for general lists, we see that the algorithms to implement these operations are similar.
True
False
Answer:
True
Explanation:
Algorithm for push function
The method of placing data on a stack is called a push operation.
It involves these steps −
Check that the stack is complete. If the stack is complete, it will cause an error . Increases top to point next empty room if the stack is not complete. Adds the data component to the place of the stack where top is pointing. Success returns.Algorithm for Insertfirst function
Create a new Link with provided data. Point New Link to old First Link. Point First Link to this New Link.As we can see that in both algorithms ,we are inserting data to a new nodes and incrementing/pointing to a new node for inserting data.Both algorithms uses the same approach.
What is the typical data transfer rate (in bps) over a SS7 transfer link?
Answer: 55 Kbits/sec - 64 KBits/sec
Explanation:
Signal System 7 (SS7) is used one of the protocols used for communication for mobile operators and it uses circuit switching. As it uses circuit switching it transfers data using a dedicated channel and hence more comparatively faster. It communicates and sends signals among Service Switching (SSPs), Signal Transfer Points (STPs), and Service Control Points (SCPs) using a different path apart from the data transfer path.
The data transfer rate which is the transfer of data among the various network elements is 55 Kilo bits/sec - 64 kilo bits/sec.
Create a program to determine the largest number out of 15 numbers entered (numbers entered one at a time). This should be done in a function using this prototype:
double larger (double x, double y);
Answer:
Output:-
Enter number:
2
Enter number:
1
Enter number:
4
Enter number:
3
Enter number:
5
Enter number:
7
Enter number:
6
Enter number:
8
Enter number:
9
Enter number:
11
Enter number:
10
Enter number:
12
Enter number:
14
Enter number:
13
Enter number:
15
Largest number: 15.0
Explanation:
Below is a java program to determine the largest number out of 15 numbers entered: -
import java.util.Scanner;
public class Largest {
double larger(double x,double y){
if(x>y)
return x;
else
return y;
}
double findLargest(){
double y;
double greatest=0.0;
Scanner s=new Scanner(System.in);
for(int i=0;i<15;i++){
System.out.println("Enter number: ");
y=s.nextDouble();
greatest=larger(greatest,y);
}
return greatest;
}
public static void main(String[] args){
Largest l=new Largest();
System.out.println("Largest number: "+l.findLargest());
}
}
_______exception inherits from exception class and _________exception is anywhere in the program.
Java , C#
C++ , C#
C# , Java
Java ,C++
Answer: Java exception inherits from exception class and C++ exception is everywhere in the program.
Explanation: Java exception are the unwanted events that occur during the run time of a particular program and breaks the flow of it. Java exception are the subclass of the exception class that is it is derived from them.So, java exception inherits from exception class.
C++ exception are those circumstances which appear during a program which are unnecessary faults during the execution of a program. the exception allows to transfer the control from one part to another part in a particular program. So, the C++ exception is anywhere in the program.
A major advantage of a method is that it is easily reusable. What does it mean to reuse a method and what are the advantages of doing so?
Answer: To reuse a method means to use a code which has been done or prepared already and just we need to change some of the functionalities.
This helps a great deal of saving time as well as helps in making the code manageable.
Explanation:
This has been practiced since long that methods can be reused. for example we need to build a calculator in c. then we can simply reuse the same method just we need to change the sign of the operator. So in this process we can speed up our operations and work and also can make the code easy to understand and manage it when we have have to deal with large lines of code.
Final answer:
Reusing a method in programming allows for using the same code in multiple places efficiently and consistently, saving time and reducing the potential for errors. It's the easiest and least disruptive way to add functionality to programs and aligns with sustainable practices.
Explanation:
Reusing a method in programming means employing a piece of code that has already been written to perform a function or a task in multiple places throughout your application. This is akin to creating a tool that can be used repeatedly in different contexts without the need to rewrite the code each time.
Advantages of Reusing Methods:
Efficiency: Reusing methods is a quick and easier way to add functionality to your programs without rewriting code, saving time and effort.Consistency: It contributes to a more robust and error-free program as the method has been tested and debugged once, ensuring consistency across its applications.Implementing reusable methods is often the easiest and least disruptive way to enhance a program, aligning with the Process Reaction Method which emphasizes simplicity and minimal interruption.Well-designed functions and methods enhance the maintainability and scalability of software by allowing the same logic to be utilized in different parts of an application or even in different projects entirely. This reusability can lead to economic and environmental benefits, as it aligns with the principles of reduce, reusable, and recycle.
The _________ statement causes a function to end immediately.
Answer:
return
Explanation:
return is the statement which is used to return the value from the function definition to the function calling.
it is also used as exit from the function.
for example:
int count()
{
return 0;
printf("hello");
}
In the above the function return 0 without print the message "hello". we can used return any where inside the function for immediately ending the execution of function.
Final answer:
The statement that causes a function to end immediately is the 'return' statement, which halts function execution and returns the flow of execution to where the function was called.
Explanation:
The statement that causes a function to end immediately in most programming languages is a return statement. When the return statement is executed, it ends the function execution and the flow of execution goes back to where the function was called, which can be likened to coming back from a 'detour'. It's important to realize that defining a function also creates a variable with the same name, which can be used to call the function later in the code.
A functional approach to programming includes various other concepts. For instance, to end the function, you have to enter an empty line in some interactive environments like REPLs (Read-Eval-Print Loop), although this is not necessary in a script. The last statement of a function plays a role similar to a 'Note of Finality' in a speech, indicating the end of the logic encapsulated by the function.
what is the online shopping?explian abstract of online shoopimg?
Answer:
Online shopping is the process where costumers buy online goods and products over the internet from the sellers. The basic concept is that it is a e-commerce which runs partially over the internet. It has grown in popularity over the years because people find it easy to bargain shop and convenient.
Abstract of online shopping :
The main objective of the online shopping is that easy to use and make it interactive. It is a web based application for online retailers and users can view the each product and its complete specifications. It is a user friendly application which also provides drag and drop features so that user can easily add the product to the shopping cart and user can also go online and make changes in the order.
What are the applicationsof Assembly Language where any high level language becomesinsufficient".
Answer and Explanation:
Assembly language is a low- level code or language used for initialization and system testing. It makes use of an assembler to convert codes and instructions in assembly language to executable machine language code.
It can be used for video processingIt can ease the accessibility of specific processor instructionsCritical Issues with performance can be addressed with the use of assembly languageIt is generally used for direct manipulation of the hardware.it can help in optimization of task and helps to run our program faster if the program is stilted or constrained in memory as it is the most primitive language computer can use.If a program is platform specific then itis better to use assembly language for better output.It can be used in real time systems, low level embedded systems, etcCan you comment on the advantages and disadvantages of having ARP responses implemented as broadcasts?
Answer:
The advantages of ARP implemented as broadcast is that it enables easy and faster transfer of messages in a network. The disadvantage of ARP is that many of the nodes in the network may update their ARP cache locally without forwarding it to other nodes.
Explanation:
Address resolution protocol(ARP) has both advantages and disadvantages when implemented as broadcast. Broadcast technology enables to transmit messges across all the nodes.
The advantages of ARP implemented as broadcast is that it enables easy and faster transfer of messages in a network. The disadvantage of ARP is that many of the nodes in the network may update their ARP cache locally without forwarding it to other nodes.
Write a code segment that takes an emailaddress stored in the string email and stores theuser name in the string user and the hostaddress in the string host. Remember that the user name and host address are separated by thecharacter @.
Answer:
#include <bits/stdc++.h>
using namespace std;
int main() {
string email,username,host;//strings to store email,username,hostname..
cout<<"Enter the email address "<<endl;
cin>>email;//taking input of email address..
bool flag=1;
for(int i=0;i<email.length();i++)//iterating over the string email..
{
if(email[i]=='@')//if @ symbol is encountered make flag 0 skip this iteration.
{
flag=0;
continue;
}
if(flag==1)//add to username if flag is 1.
{
username+=email[i];
}
else//add tom host..
host+=email[i];
}
cout<<"The username is "<<username<<endl<<"The host name is "<<host;//printing the username and hostname..
return 0;
}
Explanation:
I have taken three strings to store the email address entered by user ,username and host to store username and host name respectively.Then I am iterating over the string email if @ is encountered then skip that iteration before that keep adding characters to username string and after that keep adding characters to host.
What is internal recruitment ?
Answer:
The term ‘Internal Recruitment’ refers to the process of identifying and attracting candidates from a certain organization to another position within the same organization.
Instead of opening the position to the public and attracting random candidates some companies may choose to advertise the vacancy internally and only allow members of the staff to apply.
Internal recruitment also refers to a strategy mostly big corporations use to advertise their jobs internally. Due to the size of these companies, these job openings would otherwise go unnoticed by employees in other departments.
Write a program that lets the user guess the coin's head or tail. The program randomly generates an integer 0 or 1, which represents the head or the tail. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect. include step by step commentary.
Answer:
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
srand (time(NULL)); //initialize random seed
int guess;
int number = rand() % 2; //generate random number 0 or 1
cout<<"Enter the guess (0 or 1): ";
cin>>guess; //store in guess
if(number == guess){ //check if number equal to guess
cout<<"Guess is correct."<<endl; //if true print correct message.
}else{
cout<<"Guess is incorrect."<<endl; //otherwise print correct message.
}
return 0;
}
Explanation:
first include the three library iostream for input/output, stdlib,h for using the rand() function and time for using the time() function.
create the main function and initialize the random number generation seed, then generate the random number using the function rand() from 0 to 1.
after that, take input from user and then with the help of conditional statement if else check if random number is equal to guess number or not and print the appropriate message.
What is infix, prefix and postfixexpressions in data structures?
Explanation:
Infix notation: A+B
Operators are written in-between their operands. Expression X * ( Y + Z) / P is means: "First add Y and Z together, then multiply the result by X, then divide by P to give the final answer."
Postfix notation : A B +
Operands are written before their operators. Expression given above is equivalent to X Y Z + * P /
Operators evaluation is always left-to-right, we will not consider brackets for the order.
Prefix notation : + A B
Operands are written after their operators. Expression given above is equivalent to / * X + Y Z P
Operators evaluation is always right-to-left,we will not consider brackets for the order.
You can pin applications to which two areas?
A. Start screen
Control Panel
C. Taskbar’
D. Title bar
Answer:
A and C.
Explanation:
The taskbar and the Start are both shortcuts to use when opening applications. The taskbar is at the bottom of your computer or pc. And the start can be opened by pressing the windows key or clicking on windows at the bottom right (Windows only.)
Hope that helps!
What are the requirement analysis for COREBANKING?
Answer:
Core Banking is the system which is defined as the backbone of products and service that Bank offers. with the upcoming technology it becomes a value differentiator, and a wrong system selection that may cost tremendous opportunity losses. Core banking solution are transformed in the way bank used to operate in different manner.
The requirement analysis for CORE-BANKING is:
FunctionalityService-oriented architectureFlexibilityProgram management
---------------- is an operating systems ability to be easily enhanced over time
a) performance
b) portability
c) reliability
d) extensibility
Answer: Extensibility
Explanation:
Extensibility is one of the features which can be easily enhanced over time. As the term extensibility refers to the addition of new features and adding more features to the present modules. This does not change the internal organisation of the earlier modules in fact they add new and more improved features to the present.
Which of these suggestions is an effective way to deal withstress?
a. Meditation
b. Exercise
c. Talking with others
d. All of the given options
Answer:
d
Explanation:
all of those are good ways to deal with stress
A magnetic disk has an average seek time of 8 ms. The transferrate is 50 MB/sec. The
disk rotates at 10,000 rpm and the controller overhead is 0.3msec. Find the average time to read or write 1024 bytes.
Answer:
11.32milisec.
Explanation:
Average seek time = 8ms
transfer rate = 50MB/sec
disk rotate = 10000 rpm
controller overhead = 0.3 msec
Average time = ?
Average time is the addition of the seek time, transfer time, rotation time and ontroller overhead
[tex]Average\,time = Seek\,time+Rotation\,time+Transfer\,time+Controller\,overhead[/tex]
now, find the rotation time,
Rotation time is the time at which half rotation is made.
[tex]Rotation\,time=\frac{0.5}{rotation\,per\,second}[/tex]
convert rotation per minute to rotation per second.
[tex]rps=\frac{10000}{60}[/tex]
substitute in the above formula.
[tex]Rotation\,time=\frac{0.5}{\frac{10000}{60} }=0.003sec[/tex]
or 3milisec
now, find the transfer time by formula:
[tex]Transfer\,time=\frac{Number\,of \,read\,or\,write\,bytes}{transfer\,rate}[/tex]
so, read or write bytes is 1024
[tex][tex]Transfer\,time=\frac{1024}{50*10^{6} }=0.02milisec[/tex][/tex]
The average time is:
[tex][tex]Average\,time= 8+3+0.02+0.3=11.32milisec[/tex][/tex]
please exaplain to me, how people, Software andHardware relates specifically to
1. LANs
2. WANs
Answer:
No Answer
Explanation:
LAN : Local Area Network
Used to connect all the computers with in a building or some limited distance
so that people can share data and applications between different computers
useful for Intranet applications
WAN: Wide Area Network
used to cover large geographical area. it is network of networks. useful for computer networking.In short a WAN connects several LAN
A binary search can be performed only on ____.
A.
ordered lists
B.
comparable lists
C.
unordered lists
Develop a C++ program that simulates a user creating/entering a new password into a system.
You may presume that the username is irrelevant to complete this program.
Have the program ask the user to enter a proposed password as a string.
Validate that the password meets the following criteria:
Password must be at least ten characters long
Password must contain at least one uppercase letter
Password must contain at least one lowercase letter
C++ program for Validating password
#include <iostream>
#include<cstring>
using namespace std;
int main()//driver function
{
char password[100];//declaring variables password
int lower=0,upper=0,flag=1;
cout<<"Enter the password\n";//taking input
cin>>password;
int length = strlen(password);//finding length
for(int i=0;i<length;i++)
{
if(password[i]>=65&&password[i]<=90)/*checking string must contain at least one uppercase letter */
{
upper=1;
}
if(password[i]>=97&&password[i]<=122)/*Checking string must contain at least one uppercase letter*/
{
lower=1;
}
}
if(length<10)//checking that string length should be less than 10
{
flag=0;
cout<<"Password must be at least ten characters long\n";
}
if(upper==0)
{
flag=0;
cout<<"Password have to be at least one uppercase letter\n";
}
if(lower==0)
{
flag=0;
cout<<"Password have to be at least one lowercase letter\n";
}
if(flag==1)//if all condition turns out to true,printing Valid Password
{
cout<<"Valid Password";
}
}
Output
Enter the password
Ayushyadav
Valid Password
Enter the password
Ayush
Password must be at least ten characters long
Enter the password
anmolyadav
Password have to be at least one uppercase letter
ANMOLVIJWANI
Password have to be at least one lowercase letter
______________ Gives the Mean time for which systemremained available for use.
a) MTTF
b) MTBF
c) MTTR
d) MTTD
Answer: d)MTTD
Explanation: MTTD(Mean Time To Detect) is the time for the discovery of the problem in a system. It is basically the average time until the problem is noticed by someone. For e.g.- if there is a problem in a computer system at 9:00 am and the problem is noticed at 9:10 am by then user then the MTTD is 10 minutes . So, MTTD gives the mean time for which the system remains available for use.
Write a function that accepts an argument for a persons name. The method should loop through the number of characters in the name sending each character to the screen each on a separate line.
#include
#include
using namespace std;
int main()
{
Plese fill in.....thanks
Answer:
#include <iostream>
#include<string.h>
using namespace std;
void printCharacter(string name){
for(int i=0;name[i]!='\0';i++){
cout<<name[i]<<endl;
}
}
int main()
{
string name;
cout<<"enter the name: ";
cin>>name;
printCharacter(name);
}
Explanation:
first include the two libraries iostream for input/output and string library for using the string.
then, create the main function and declare the variable type string.
cout instruction is used o display the message on the screen.
cin is used to store the value in the name variable.
after that, call the function. The program control move to the the function. In the function for loop is used to print the character one by one until end of the name.
ebay employs the _____ auction mechanism.
A. forward
B. reverse
C. dutch
D. proprietary ebay
Answer:
A. Foward
Explanation:
ebay employs the forward auction mechanism.
If a compiler detects a violation of language rules, it refuses to translate the class to ____.
a.
machine code
b.
a logic error
c.
an application
d.
Java
Answer:
The correct answer is a. Machine code
Explanation:
The syntax of a language is a set of rules that indicates how to write programs.
A compiler is a system that in most cases has to handle an incorrect entry. Especially in the early stages of creating a program.
Syntactic errors are those that occur at the time of writing the program in the high level programming language and that do not comply with the grammatical rules of said programming language. These errors are generally detected by the compiler itself, since it only translates programs that are ''well written''. Therefore, a program that contains syntactic errors can never be compiled.
In summary, syntax errors are detected in the process of translating source code into binary code. On the contrary that happens with the errors of execution and of logic, that can only be detected when the program in being executed.
Answer:
a. machine code
Explanation:
When we code a program, be it in C, C++, Java, etc,..., the role of the compiler is to translate our code to machine code, so it can be executed.
This only happens if we do not violate any of the language rules. Otherwise, there are going to be compilation errors and we will have to fix our code before it is compiled, that is, translated to machine code.
So the correct answer is:
a. machine code
Give Short and to the point answers(Answer the question keeping in view itsmarks)
Why we called COBOL as a professional language and not ataught language
Answer:
COBOL(Common Business Oriented Language).As the name suggests it is most commonly used to develop business tools and hence it is called a professional language and it is not used in schools or colleges as a teaching tool like FORTAN hence it is not called a taught Language.
COBOL is also used to develop business applications.It is mainly designed for businesses.
Open addressing can be implemented in several ways.
True
False
Answer: True
Explanation:
yes, open addressing can be implemented in several ways as it is a method of collision resolution in hash table. Open addressing can be implemented in different ways as linear probing, quadratic probing and double hashing. As open addressing requires more computation. In open addressing as everything is stored in the same table.
Why has the PCM sampling time beenset at 125 microseconds?
Answer Explanation:c
PCM( pulse code modulation) is a process for transmitting the analog data from one place to other place the signal which are used in pulse code modulation are binary that is only 0 and 1 using PCM all forms of analog data can be form including voice music etc.
to obtain pcm an analog signal is sampled at regular time interval the sampling rate is very high as compared to the frequency used by analog signal. the instant amplitude of analog signal at each sampling is being closer to the nearest several specific earlier levels.this process is called tantalization. in this the number of level is power of 2 so the sampling time is set as 125 microseconds.
Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp = {90, 92, 94, 95}, print: 90, 92, 94, 95 Your code's output should end with the last element, without a subsequent comma, space, or newline.
Answer:
#include <iostream>
using namespace std;
int main() {
int NUM_VALS;//variable NUM_VALS for the size of the array..
cout<<"Enter the size of the array"<<endl;
cin>>NUM_VALS;//taking input the size of the array..
int hourlyTemp[NUM_VALS]; //declaring array hourlyTemp of size n..
cout<<"Enter values of the array "<<endl;
for(int i=0;i<NUM_VALS;i++)
cin>>hourlyTemp[i];//taking input of hourlyTemp
for(int i=0;i<NUM_VALS;i++) //for loop for iterating over the array..
{
if(i!=NUM_VALS-1)
cout<<hourlyTemp[i]<<", ";// print statement.
else
cout<<hourlyTemp[i];//print statement.
}
return 0;
}
Explanation:
I have taken NUM_VALS variable for the size of the array hourlyTemp. First i am taking input the size of array form user and after that array elements are also entered by the user.I am iterating over the array using for loop and checking that it is not the last element if it is simply printing it if it is not then printing comma and space also.
Define a class Complex for complex numbers. A complex number is a number of the form: ???? + ???? ∗???? where a and b are real and imaginary part of a complex number and i is a number that represents the quantity √−1 . Addition of two complex numbers: (???? +???????? )+(???? +????????) = (???? +????) + (???? +????)???? Subtraction of two complex numbers: (???? +????????)−(???? +????????) = (???? −????)+(???? −????)???? Create a class Complex that contains: Two private variables real and imaginary of type double. Define accessor and mutator functions of real and imaginary variables. Overload the following operators "+" and "–" so that they apply correctly to the type Complex. Test your program with inputs (5+4i) and (2+2i).b
Explanation:
--!#&?&#&#(-$(-$)-"-)"(-'-)';'!'+%