Set - 7

Question 16 :

Is C an object-oriented language? 

Answer :

C is not an object-oriented language, but limited object-oriented programming can be done in C.


Question 17 :

Name some major differences between C++ and Java?

Answer :

C++ has pointers; Java does not. Java is platform-independent; C++ is not. Java has garbage collection; C++ does not. Java does have pointers. In fact all variables in Java are pointers. The difference is that Java does not allow you to manipulate the addresses of the pointer


Question 18 :

What is the difference between Stack and Queue?

Answer :

Stack is a Last In First Out (LIFO) data structure. 
Queue is a First In First Out (FIFO) data structure


Question 19 :

Write a fucntion that will reverse a string?

Answer :

char *strrev(char *s){
	int i = 0, len = strlen(s);
	char *str;
	if ((str = (char *)malloc(len+1)) == NULL)
		/*cannot allocate memory */
		err_num = 2;
		return (str);
	}
	while(len)
		str[i++]=s[–len];
		str[i] = NULL;
	return (str);
}

 


Question 20 :

What is the software Life-Cycle?

Answer :

The software Life-Cycle are
1) Analysis and specification of the task
2) Design of the algorithms and data structures
3) Implementation (coding)
4) Testing
5) Maintenance and evolution of the system
6) Obsolescence