CSE1146 Final Sorular ve Cevaplar
CSE1146 Final sınavının sorularını çözdüğüm gibi ekledim buraya. Yarın öbürgün güncellerim belki.
3 Sayı Değiştirici (15 puan)
Write a C function named void swap3Numbers(int *x, int *y, int *z)
to swap three elements using call by reference. For example if the inputs are 5, 6, 7 then they should become 7, 5, 6. Do not attempt to solve this question without pointers!
Çeşitli Şeyleri Sayaç (25 puan)
Write a complete C++ program to count
- Number of words
- Number of spaces
- Number of vowels (both uppercase and lowercase vowels)
- Number of characters
that a string taken from the user.
Note that the letters a, e, i, o, and u are called vowels. The other letters in the alphabet are called consonants.
Stack Sınıfı Yaratma (35 puan)
Write a complete C++ Program to implement your own stack. Your stack should be able to implement the following functions:
- push,
- pop,
- display
For each operation prompt the user as follows:
"Enter your choice: "
You can define a simple menu to manage your stack; if user selects 1 in the menu, your program should make a push operation, for 2 pop operation and for 3 you should display the contents of your stack.
If user selects 1 to push something and the stack is full, then print the following message on the screen:
"Stack is full"
If user selects 2 to pull from the stack and the stack is empty, then print the following message on the screen:
"Stack is empty"
After each operation ask the user the following question:
"Do you want to continue? (y/n)", if user answers it with "y" for indicating yes, then continue with the execution, else if user answers it with "n" for indicating no, then stop the execution of your program immediately.
You must define at least one class in your program.
Hint-1: You may consider an integer array to store data, that is, each element in your stack is an integer.
Hint-2: You can assume the maximum size of your stack is 100, 1000 or something.
Test Soruları (5'er puan)
Bunlardan emin değilim, hocanın cümleyi kurma biçimden anlayamadım ancak çıkarım yapa yapa ilerleyerek şu cevapları verdim.
- Which syntax of inheritance of class is given in the following? (Cevabımdan eminim.) – class name : access specifer class name
- What is the unique property of the destructor? (Cevabımdan eminim.) – It has the name same as class
- Derived class pointer would be treated as base class pointer. (Çoğunlukla eminim.) – False
- In polymorphism, an object from base class can not be allocated by using new keyword. (Hiç emin değilim.) – False
- Which of the following statement is true for virtual functions? (Çoğunlukla eminim.) – indicates, prototype of that member function is going to be used at following derived classes.