What is the difference between normal variable and register variable in c?
In C/C++ when we declare a variable;
e.g
int var;
for this variable (i.e. var) memory is being reserved in RAM (i.e out side processor).
If we declare variable like that;
register int var2;
for this variable memory is being reserved in register of CPU (i.e. withing processor)
But register variables are discouraged because processor has to work with registers.....
Note: strictly speaking, storage class 'register' means: dear compiler, you might optimize this variable into register, as I won't ever request its address. But of course, it's up to you to decide.
What method returns the uppercase equivalent of a string?
The toUpperCase() method returns the uppercase equivalent of a string.
What is Design pattern in java?
The design patterns are language-independent strategies for solving common object-oriented design problems. Some common design patterns in Java are:
Can you declare float variable as increment operator in for loop?
I don't really understand your question, but for example the following code is perfectly legal:
float f;
for (f=0.0; f<=1.00001; f += 0.1) printf ("%g\n", f);
True or false All methods in an abstract class must be abstract?
False. In fact, it is possible to have no abstract methods in an abstract class.
What are the 5 key activities in an object-oriented design process?
1. Understand and define the context and external interactions with the system.
2. Design the system architecture.
3. Identify the principal objects in the system.
4. Develop design models.
5. Specify interfaces.
a language is called platform dependent only if its compilation and execution depends on underlying system. the system supporting is required here
The literals with single quotes are Characters and can have a width of only one. Ex: 'y' or 'a' etc
Strings cannot be declared using single quotes. They have to be declared with double quotes.
What are different types of access modifiers?
An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are:
1. Public
2. Protected
3. Default and
4. Private
Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.
Java programming does not run by just a single piece of class that has the whole functionality. You have hundreds of classes that interact with one another, passing data between them and returning output to the user of the system. So it is very important for members of one class to access members of another. Here members may refer to variables, methods and even classes. So, this is where the access modifiers come into picture. The modifier associated with every member of the class determines what level of visibility that member has.
A public name is a name that is widely recognized and used by the general public, often associated with a brand, organization, or individual. It can serve as a form of identity that distinguishes a person or entity in the public sphere, and may be used in marketing, media, and social contexts. Public names can include stage names, company names, or even pseudonyms that enhance visibility and memorability.
What is the difference between generic collection and non generic collection in java?
Generic collections were introduced in Java 1.5 and since then have become preferable to non-generic collections. A non-generic collection defaults to being a collection of Objects, and in order to effectively use those Objects, you need to cast them as their correct data type during use. A generic collection knows what type of object it contains, and thus no casting is needed.
Difference between single valued and multivalued attribute?
single value attribute is one that holds a single value for a single entity.
example:- name, roll_number...
multivalued attribute is one that holds multiplevalues for a single entities.
example:- degree(phd, mca)
Can a processs BSS segment grow during program execution?
No. The size of the data segment (which includes the BSS) is determined at compile time and cannot change at runtime. The data segment stores all the program's constants, global variables and static variables, the total size of which can be determined at compile time and is therefore fixed at that point. BSS is an abbreviation of Block Start by Symbol and is used specifically to allocate all global and static variables that are either in an uninitialised state or are explicitly initialised to zero. Global and static variables initialised with non-zero values are allocated separately from the BSS, as are all the constants.
The javap command is used to disassemble one or more class files. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it. javap prints its output to stdout.
For example: javap java.lang.String dumps all the methods for the String class.
How char data type is represented in the memory?
The char data type is a single 16-bit, unsigned Unicode character. It ranges from 0 to 65,535. They are not integral data type like int, short etc. i.e. the char data type can't hold the numeric values. The syntax of declaring a char type variable is shown as:
char caps = 'c';
What is 8478 in the latice method?
Since you did not specify a multiplier, I will use a multiplier of 15 for the purpose of illustrating a problem. So you would set up a lattice with 8478 on top and 15 down the left side. In the second row of the lattice, you would have the following: 0/8,0/4,0/7,and 0/8. The second row of the lattice would be filled in as follows: 4/0, 2/0,3/5,and 4/0. You would then add the diagonal columns, starting with the farthest right. Your answer would be 127,170.
Write a program to reverse a 5 digit number using function?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int reversenum(int original);
int main(int argc, char * argv[]){
int numval;
if(argc != 2){
printf("Please specify a number.\n");
exit(1);
}
numval = atoi(argv[1]);
printf("The reverse of %i is %i\n", numval, reversenum(numval));
return 0;
}
int reversenum(int original){
int returnval = 0;
int val = abs(original);
int sign = sgn(original);
while(val > 0){
returnval *= 10;
returnval += val % 10;
original /= 10;
}
returnval *= sign;
return returnval;
}
Why static variables are initialized to zero?
When a variable is declared, your computer assigns a section of memory to that variable. If the variable isn't initialized, there's no way of knowing what data is already stored in that section of memory, which can cause errors in your programs.
In managed languages, such as C#, this is done automatically at declaration. Although it's still good practice to initialize variables yourself.
Write a java program to show following pattern 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1?
// num = the highest number to start with
final int num = 5;
// Go through each value from num through 1.
for (int n = num; n > 0; --n) {
// For each value, print each value from num all the way down to the value.
for (int m = num; m >= n; --m) {
System.out.print(m);
System.out.print(' ');
}
}
int a,b,c,result;
result=a+b+c/3;
system.out.println("result="+result);
Learn C! :-)
There are several functions in C that can be used to read input from the user, such as getc(), getchar(), and scanf(). Files can be written to using fprintf() and putc(). They can be opened with fopen() and closed with fclose().
Explain what a random number is?
That means that a number is selected randomly from a certain set. For example, if you throw a die, you can randomly get any of the integers from 1 to 6. It is random, because you don't know the result in advance.
That means that a number is selected randomly from a certain set. For example, if you throw a die, you can randomly get any of the integers from 1 to 6. It is random, because you don't know the result in advance.
That means that a number is selected randomly from a certain set. For example, if you throw a die, you can randomly get any of the integers from 1 to 6. It is random, because you don't know the result in advance.
That means that a number is selected randomly from a certain set. For example, if you throw a die, you can randomly get any of the integers from 1 to 6. It is random, because you don't know the result in advance.