StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

Programming Questions - Research Paper Example

Cite this document
Summary
The paper "Programming Questions" tells us about some questions regarding programming. Functions declared as public will be used, through calling, by clients to manipulate the class data, they cannot directly access the data hour, min, second because they are declared as private…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER98.2% of users find it useful
Programming Questions
Read Text Preview

Extract of sample "Programming Questions"

 A constructor is constructed by the class in case it is not written by the programmer. In this case time() is the default constructor which will be used in case time( int hh, int mm, int ss) is not used.  

  1. d) Instance variables are the variables hh, mm, ss that are used to pass the values given by the user to the constructor.
  2. e) A setter method sets a value to a variable of an object. In this example void setTime (int hh,int mm, int ss) is a setter method.

   Question 27                                                 

  1. Time ( ) and Time (int hh, int mm, int ss) are both constructors. Time() is the default that initializes random values in case Time (int hh, int mm, int ss) is not defined by the user in the program.
  2.  

void Time::setTime (int hh, int mm, int ss);

{

            hour = (hh>=0 && hh<24) ? h :0;

            mnute = (mm>=0 && mm<=60) ? m : 0;

            second = (ss>=0 && ss <60 ) ? s : 0;

}

 

Time::Time()

{

      hh=mm=ss=0;

}

           

  1. Int Time::timesAreEqual (Time &tl, Time &t2);

{

            if ( t1.hour= t2.hour && t1.minute == t2.minute && t1.second == t2.second );

            return 1;

            else

            return 0;

}

Question 28

  1. a) A pointer is a variable that holds some memory address.
  2. b) An array in C++ is a variable that holds subsequent memory locations up to the number declared by the user. The first element in the array has the index 0.
  3. d) when the statements q1 = &x; and q2 = &y; are executed pointer q1 get the value of x and q2 gets the value of y.

x

78

y

96

 

     

 


    x=78         y=96

 

Question 29

 

  1. Dynamic data structures can grow or shrink according to the wish of the programmer. Static values do not hold this property; once declared they remain fixed to the defined length.
  2. After the assignment chPtr = new char[10]; chPtr content will be the memory location where char[10] is stored.

 

Question 30

  1. Encapsulation in object-oriented programming is a technique that integrates data and operations to make an object. The benefits of encapsulation are abstraction and security. Abstraction in the sense that the operations and properties of an object are hidden from the outside world who is not bogged down with the inner workings of the object and security because the outside world can access the object only through its interface and does not have access to the inner workings of the object the outside world, therefore, cannot mess with the object.
  2. They include data and operations into a single entity.
  3. Inheritance and Polymorphism, with inheritance classes, get properties from other classes, and with polymorphism, object operations are dynamically defined during program execution.
  4. Inheritance allows reusing previously defined classes. There are three benefits of inheritance use: (i) reuse of existing code from the base class, (ii) all children of the base class have the same methods, and (iii) the programmer can redefine in the child class methods from the parent class.
  5. “Signature” defines parameters overloading of the parents' class. Functions’ signature has to be unique to avoid confusion of overloaded parent class parameters.

 

Question 31

 

struct Zebra

{

            char * name;

            int age;

            char * zoo;

            int weight;

            char * vet;

            void setName(char * nameIn);

            void setAge(int ageIn);

            void setZoo(char * zooIn);

            void setWeight(int weightIn);

            void setVet(char * vetIn);

            void getName();

            void getAge();

            void getZoo();

            void getWeight();

            void getVet();

}

#include Zebra.h

 

void Zebra::setName(char * nameIn)

{

            int size;

            size=strlen(nameIn);

            name=new char[size+1];

            strcpy(name, nameIn);

}

void Zebra::setAge(int ageIn)

{

            age=ageIn;

}

void Zebra::setZoo(char * zooIn)

{

            int size;

            size=strlen(zooIn);

            zoo=new char[size+1];

            strcpy(zoo, zooIn);

}

void Zebra::setWeight(int weightIn)

{

            weight=weightIn;

}

void Zebra::setVet(char * vetIn)

{

            int size;

            size=strlen(vetIn);

            vet=new char[size+1];

            strcpy(vet, vetIn);

}

void Zebra::getName()

{

            cout<<name;

}

void Zebra::getAge()

{

            cout<<age;

}

void Zebra::getZoo()

{

            cout<<zoo;

}

void zebrea::getWeight()

{

cout<<weight;

}

void getVet()

{

cout<<vet;

}

 

int main()

{

            Zebra array[3];

            for (int i=0; i<3; i++)

{

            char * nameIn, *zooIn, *vetIn;

            int ageIn, weightIn;

            cout<<” Please enter zebra name, age, zoo it resides, weight and name of vet.”<<endl;

            cin>>nameIn>>ageIn>>zooIn>>weightIn>>vetIn;

            array[i].name=nameIn;

            array[i].age=ageIn;

            array[i].zoo=zooIn;

            array[i].weight=weightIn;

            array[i].ver=vetIn;

}

for (int j=0; j<3; j++)

{

            cout<<array[i].getName();

            cout<<array[i].getAge();

            cout<<array[i].getZoo();

            cout<<array[i].getWeight();

            cout<<array[i].getVet();

}

}

Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“Programming Research Paper Example | Topics and Well Written Essays - 2250 words”, n.d.)
Programming Research Paper Example | Topics and Well Written Essays - 2250 words. Retrieved from https://studentshare.org/technology/1527123-programming
(Programming Research Paper Example | Topics and Well Written Essays - 2250 Words)
Programming Research Paper Example | Topics and Well Written Essays - 2250 Words. https://studentshare.org/technology/1527123-programming.
“Programming Research Paper Example | Topics and Well Written Essays - 2250 Words”, n.d. https://studentshare.org/technology/1527123-programming.
  • Cited: 0 times

CHECK THESE SAMPLES OF Programming Questions

Management of Continuous Programmer Education within the Irish Software Industry

The widespread use of the latest technology also brings with it new programming techniques or function calls that capitalize on the new power of the new technology.... Programmers in order to remain competitive should be updated in the latest programming languages, techniques, and technology....
7 Pages (1750 words) Research Paper

Effecitve Risk Management in Softwatre Development Utilizing Different Methodologies

Chapter 1---Introduction 1.... Introduction of the Research Software development business is a risky industry in that software projects are renowned for high rate of unsuccessful.... According to Standish Group International Reports, 34 % of the software projects among 7400 projects were not capable to deliver on time and only 24% were completed within schedule, yet 31 % of the projects were cancelled (Baccarini; Salm and Love, 2004)....
5 Pages (1250 words) Dissertation

Life Plan and Personality Development: Bill Gates

A laconic but informative description on questions about this personality such as how was he brought up, the social atmosphere and environment he grew in, and some special incidents which had a revolutionary impact on his thinking capabilities and made him what he is today have been answered in this paper.... Both of them had a common interest in computer programming which made them fast friends (Sherman, 2000)....
5 Pages (1250 words) Essay

Neuro-linguistic Programming

The writer of the paper “Neuro-linguistic programming” states that on the basis of the research that has appeared in the literature, it is not possible to determine the validity of either NLP concepts or whether NLP-based therapeutic procedures are effective for achieving therapeutic outcomes.... hellip; Neuro-Linguistic programming (NLP) is a way of organizing and understanding the structure of subjective experience and is concerned with the ways in which people process information but not necessarily with the specific content of that information....
18 Pages (4500 words) Essay

Planning, Programming, Budgeting and Execution

From the paper "Planning, programming, Budgeting and Execution" it is clear that Planning, programming, Budgeting and Execution system works well when all the phases properly work and coordinate in relation to one another.... hellip; Generally speaking, PPBE is the planning, programming, budgeting and execution system.... So, here I am explaining some key and practical terms including PPBE, Planning, programming, Budgeting and Execution in the context of the main theme of the research paper....
10 Pages (2500 words) Research Paper

Computer Programming: The Advantages of Object Oriented Programming

The author also analyzes the statement that 'to operate' a computer is far easier, yet less powerful, than 'to program' a computer and discusses the advantages of object-oriented programming.... hellip; An entry-level programming job is preferred by the students, new graduates, and part-time workers.... In this scenario, the entry-level programming job offers a basic step towards the enhancement of personal skills regarding the concerned profession....
6 Pages (1500 words) Assignment

Proof, Language, and Interaction: Essays in Honour of Robin Milner

A database developed in the form of the relational model is the relational database, and the purpose of the relational model is contrived to offer a declarative system for specifying the data and questions.... Subsequently, the software takes care of defining the data structures of storing the information and retrieval system for answering the questions.... The Briton is significantly known for the pioneer of automated theorem proving programming language design and concurrent systems (Plotkin et al....
2 Pages (500 words) Assignment

Object Oriented Programing Languages

This report "Object Oriented Programing Languages" discusses object-oriented programming languages that are dominant in terms of programming languages.... The advantages that are offered make the languages more efficient and effective in computing processes as compared to structured programming.... haun Bebbington (2014) defines computer programming as the process through which executable programs are formulated to solve computing problems....
15 Pages (3750 words) Report
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us