C++ Basic 2018 (Batch-2)
763 subscribers
277 photos
11 videos
30 files
74 links
🎯 C++ Basic 2018 (Batch 2) - Pre-Engineering Edition
My second family of coders! πŸ‘¨β€πŸŽ“πŸ‘©β€πŸŽ“
Specifically for 2018 pre-engineering students finding C++ challenging.
We turn confusion into clarity, one concept at a time.
Join the struggle bus - destination
Download Telegram
αˆ΅α‰΅αˆ˜α‹˜αŒˆα‰‘ 50000 BTTC α‹­αˆ°αŒ£α‰Ήαˆƒαˆ αŠ¨α‹› α‰ αˆ˜α‰€αŒ αˆ Sign In α‹¨αˆα‰΅αˆˆα‹ α‹αˆ΅αŒ₯ ገα‰₯ታቹ 20000 BTTC α‹­αˆ°αŒ£α‰Ήαˆƒαˆ αŠ αŒ α‰ƒαˆ‹α‹­ αˆαŠ•αˆ αˆ³α‰΅αˆ°αˆ© 70000 BTTC α‹­αˆ°αŒ£α‰Ήαˆƒαˆ αŠ¨α‹› Withdraw αˆ›α‹΅αˆ¨αŒ αŠα‹ fam

πŸ‘‡αˆˆαˆ˜αŒ€αˆ˜αˆ­πŸ‘‡
https://bttcweb.com/pages/register/register?code=7574712
❀1
C++ Basic 2018 (Batch-2)
Final exam 2023_2.pdf
βœ…Answer  πŸ‘‡

PART I β€” True or False

1. "If a condition is false, its statement executes and terminates the chain"
Explanation: When a condition is false, its body is skipped, not executed.
βœ… Answer: FALSE       

2. "A function cannot be defined inside another function"
Explanation: In C++, you strictly cannot write a function inside another function.  α‰  C++ α‹αˆ΅αŒ₯ αŠ αŠ•α‹΅ function α‹αˆ΅αŒ₯ αˆŒαˆ‹ function መጻፍ αŠ α‹­α‰»αˆαˆα’ α‹­αˆ… የ C++ αŒ₯α‰₯α‰… rule αŠα‹α’
βœ… Answer: TRUE


3. Does *ptr = 11 change i to 11?
Explanation: ptr holds the address of i. Using *ptr means go to that address and change the value β†’ i becomes 11.                                                                                                 ptr የ i αŠ• address α‹­α‹Ÿαˆα’ *ptr = 11 αˆ›αˆˆα‰΅ "α‹ˆα‹° address αˆ‚α‹΅ αŠ₯αŠ“ valueα‹αŠ• α‰€α‹­αˆ­" αˆ›αˆˆα‰΅ αŠα‹ β†’ i = 11 α‹­αˆ†αŠ“αˆα’
βœ… Answer: TRUE


4. Can both foo functions coexist?
Explanation: Yes β€” this is function overloading. Same name, different parameters = allowed.
βœ… Answer: TRUE


5. Is strlen("Cletus") equal to 7?
Explanation: strlen() counts only the letters β€” NOT the null character '\0'. "Cletus" = 6 letters β†’ strlen = 6.
βœ… Answer: FALSE 

PART II β€” Multiple Choice


Q1. Which array declaration is NOT correct?
Explanation: Arrays must be initialized with curly braces {}, not square brackets [].
βœ… Answer: C


Q2. Which is NOT true?
Explanation: Option B says "when condition is false, the if body executes" β€” that is completely wrong. When false, the else body runs.
βœ… Answer: B


Q3. Statement for alternate paths based on condition?
Explanation: for and while are loops. The if statement is used for choosing alternate execution paths.
βœ… Answer: A


Q4. Which is TRUE about arrays?
Explanation: Array size must be decided at compile time β€” you can't change it while the program runs.
βœ… Answer: C


Q6. Correct variable name?
Explanation: Variable names can only have letters, digits, and underscore _. $ and @ are not allowed in C++.
βœ… Answer: B


Q7. Output of str[5]?
Explanation: Counting from index 0: H(0) e(1) l(2) l(3) o(4) space(5) β†’ space is at index 5.
βœ… Answer: C β€” Space


Q8. Output of -2 * array[2]?
Explanation: array[2] = 40 (third element). Then -2 Γ— 40 = -80.
βœ… Answer: C β€” -80

Q9. Pointer program output?
Explanation: ptr = x assigns the value 7 as an address β€” this is wrong. It should be ptr = &x. This causes a compiler error
βœ… Answer: C β€” Error

Q10. Output of const program?
Explanation: const means the value cannot be changed. Trying a++ on a const variable causes a compiler error.
βœ… Answer: D β€” Error

Q11. How many times is "CppBuzz.com" printed?
Explanation: i goes from 0 to 4 (when i=5, condition i<5 is false β†’ no goto). So it prints 5 times.
βœ… Answer: B β€” 5 times


Q12. Output of a++, b, c?
Explanation: b = a++ means b gets the current value of a (10) first, then a becomes 11. Then c = a β†’ c = 11. Output: 11 10 11
βœ… Answer: A β€” 111011

Q13. Variable declared inside a function?
Explanation: A variable declared inside a function only exists within that function β€” called a local variable.
βœ… Answer: B β€” Local variable

Q14. Output of car() program?
Explanation: car() is called once in main β†’ prints "Audi R8" once.
βœ… Answer: A β€” Audi R8

Q15. Output of fun(x, y)?
Explanation: fun uses pass by value β€” it receives copies. Changing x and y inside fun does NOT affect the originals in main. So y stays 20.
βœ… Answer: B β€” 20
                                                                                                                                                                                      PART III β€” Short Answers

Q1. Declaration of x pointed to by Ptr:
Explanation: To declare a pointer to an integer variable:
int x;
int *Ptr = &x;
Q2. Pass by Value vs Pass by Reference:
Explanation :
Pass by Value -A copy is sent to the function and Original is NOT changed
Pass by Reference-The actual variable is sent using & and Original IS changed

@ProgrammingWithFaith2018
❀1πŸ‘1
void byValue(int x) { x = 100; }    // original value αŠ α‹­α‰€α‹­αˆ­αˆ
void byRef(int &x)  { x = 100; }    // original value α‹­α‰€α‹­αˆ«αˆ

Q3. Function Overloading:
Explanation: Multiple functions with the same name but different parameters. The compiler chooses the right one based on the arguments passed.  αŠ αŠ•α‹΅ ሡም α‹«αˆ‹α‰Έα‹ αŒαŠ• α‹¨α‰°αˆˆα‹«α‹© parameters α‹«αˆ‹α‰Έα‹ functionsፒ compiler α‹¨αˆšαŒ αˆ©α‰ α‰΅αŠ• arguments α‰°αˆ˜αˆ­αŠ©α‹ž α‰΅αŠ­αŠ­αˆˆαŠ›α‹αŠ• function α‹­αˆ˜αˆ­αŒ£αˆα’
int add(int a, int b)       { return a + b; }   // αˆαˆˆα‰΅ int
float add(float a, float b) { return a + b; }   // αˆαˆˆα‰΅ float
// αŠ αŠ•α‹΅ ሡም αŠα‹ "add" - αŒαŠ• parameters α‹­αˆˆα‹«α‹«αˆ‰
    

                                                                                                                                                                               
PART IV β€” Output Questions

Q1. 2D Array output:
Explanation: The loops run only for i=2, j=0 β†’ that is val[2][0] = 1.
βœ… Output: 1

Q2a. break version:
Explanation: sum=+i means sum = +i (assign), not sum += i (add). When i=3, break fires immediately before assignment.
i=5 β†’ sum=5, i=4 β†’ sum=4, i=3 β†’ break!

βœ… Output: 4

Q2b. continue version:
Explanation: continue skips to the next iteration. sum+=i comes after continue so it never executes. Sum stays 0.
βœ… Output: 0

Q3. String program:
Explanation: strncpy(z, y, 9) copies first 9 characters of y into z. Then z[9]='\0' ends the string.
βœ… Output:
String y: It is a nice day
String z: It is a n

Q
4. Swap function:

Explanation : A is pass by value (copy), B is pass by reference (real). So only b changes in main.
A=4+18=22 (local), B=22-18=4 (b in main changes!), A=22-4=18 (local only)
Back in main: a=4, b=4
βœ… Output: 4, 4


PART V β€” Programs


Q1. Income Tax
using namespace std;
int main(){
    float salary, tax = 0;
    cout << "Enter salary: ";
    cin >> salary;

    if(salary <= 200)
        tax = 0;
    else if(salary <= 600)
        tax = (salary - 200) * 0.10;
    else if(salary <= 1200)
        tax = 400*0.10 + (salary - 600)*0.15;
    else if(salary <= 2000)
        tax = 400*0.10 + 600*0.15 + (salary-1200)*0.20;
    else if(salary <= 3500)
        tax = 400*0.10 + 600*0.15 + 800*0.20 + (salary-2000)*0.25;
    else
        tax = 400*0.10 + 600*0.15 + 800*0.20 + 1500*0.25 + (salary-3500)*0.30;

    cout << "Income tax = " << tax << " Birr" << endl;
    return 0;
}

Q2. Count students below 45
using namespace std;
int main(){
    int n, mark, count = 0;
    cout << "Enter number of students: ";
    cin >> n;
    for(int i = 0; i < n; i++){
        cout << "Enter mark for student " << i+1 << ": ";
        cin >> mark;
        if(mark < 45)
            count++;
    }
    cout << "Students below 45: " << count << endl;
    return 0;
}

Q3. Enter until negative
using namespace std;
void enterNumbers(){
    int num;
    while(true){
        cout << "Enter a number: ";
        cin >> num;
        if(num < 0){
            cout << "Now you have entered a negative number" << endl;
            break;
        }
    }
}
int main(){
    enterNumbers();
    return 0;
}


@ProgrammingWithFaith2018
❀4
If anyone has last year's C++ final exam, please post it here in the comment section. πŸ’»πŸ“

@ProgrammingWithFaith2018
πŸ“²
1.

Function declaration malet just le compilerሁ sle function αˆ˜αŠ•αŒˆαˆ­ nw

Syntax : datatypes  functions_name(parameters )

Example

int sum(int a,int b)
with parameter
int sum() without parameter


So

Answer:) D
Because it lack return type


2.
ANSWER:) A

We define structure first then we create a variable @ProgrammingWithFaith2018
❀3
3.
To create 2D array the syntax is:)
Datatypes array[row][column ]

int array[10][5];

Answer :) C

4.

Answer :) A
❀2
5.

Arrya is collection of elements with the same data types.

To access first element of array we use

Array[0]

To access the last

Array[n-1]

But to access the memory address of first element just we call it's name

for example int ages[]={1,3};
ages // to access the memory address of first element

So

βœ…Answer :)D

6.

Strcpy(a,b) copies the entire string from b to a

So

βœ…Answer :) A
❀3
7.

For loop that run from 5 to 105 in steps of 4

for (int i=5;i<=105;i+=4)

βœ…Answer:) A


8.

Do while is different from while in the code in do while is executed at least once.

βœ…Answer:) B
❀4
9.

Break :) terminates execution immediately .

βœ…Answer D
❀5πŸ‘Ž2
Forwarded from Hustler Hub (✞Faith✞)
αŠ«αˆαŠ‘ viral αˆ³α‹­α‹ˆαŒ£ αŒ€αˆαˆ©

αˆ˜αŒ€αˆ˜αˆͺα‹« link αŠ•αŠ©α‰΅ α‰ αˆ˜α‰€αŒ αˆαˆ α‹ˆα‹° playstore αˆ²α‹ˆαˆ°α‹³α‰½αˆ app download αŠ£αˆ­αŒ‰α‰΅ ልክ αˆ²αŠ¨αα‰΅αˆ‹α‰½αˆ α‰  google account αŠ­αˆα‰± αŠ£αˆˆα‰€

βœ…α‰ α‰°αˆ¨αˆ αˆ°α‹ αŒ‹α‰₯α‹™,video α‰ αˆ›α‹¨α‰΅αˆ α‹­αŠ¨ααˆ‹αˆ
1 invitatin -  1$$$$$

αŒαŠ• α‰ΆαˆŽ αŒ€αˆαˆ©

α‹«αˆαŒˆα‰£α‰½αˆ ነገር ካለ αŒ α‹­α‰αŠ

linkπŸ‘‡
https://play.google.com/store/apps/details?id=com.app.cash.adda.playandwin

1000 coin =1$ αˆˆαˆ˜α‰€α‰ αˆ αŠ¨α‰³α‰½ α‹«αˆˆα‹αŠ• Referral code copy αŠ αˆ­αŒ‹α‰½αˆ αˆ™αˆ‰
                πŸ‘‡πŸ‘‡
M97b6xshpKQNOLUkbKwc2T1gxPw2

@examanswer1
😁2❀1

How affirmative action work ?


‎Affirmative Action α‹¨αˆšαˆ°αŒ α‹ αˆˆαˆ΄α‰Άα‰½ ፣ከ αŠ α‹³αŒŠ ክልል ለመ጑ αŠ₯αŠ“ ለ አካል αŒ‰α‹³α‰°αŠžα‰½ αŠα‹α’
‎ So αˆ΄α‰Άα‰½ 20%
‎      αŠ α‹³αŒŠ ክልል  5%
‎      አካል αŒ‰α‹³α‰°αŠžα‰½  5% Free quota αŠ αˆ‹α‰Έα‹  αˆ›αˆˆα‰΅ αŠα‹α’

‎ለምሳሌ :-Software maximum in take capacity last year 80 students αŠα‰ αˆ­α’ 

‎80%20 = 16  ,so  64 α‰°αˆ›αˆͺ α‰  rank αŠα‹ αˆšαŒα‰£α‹ α‹¨α‰€αˆ©α‰΅ 16 α‰°αˆ›αˆͺ α‹°αˆž free Quota αˆˆαˆ΄α‰Άα‰½ አለፒ


‎ αŠ₯αŠ•α‹΅ αˆ΄α‰΅ rankα‹Ž 160 α‰’αˆ†αŠ• αŠ₯αŠ“ Software  α‰  Affirmative αˆ˜αŒα‰£α‰΅ α‰₯ፈልግ  64 α‰ α‹‹αˆ‹ α‹«αˆŽα‰΅αŠ• αˆ΄α‰Άα‰½ αˆ˜α‰αŒ αˆ­ αŠα‹ , ለምሳሌ 1-160 rank α‹ˆαˆ΅αŒ₯ 30 αˆ΄α‰Άα‰½ α‰’αŠ–αˆ© ፣ ከ αŠ₯αŠα‹› α‹‰αˆ΅αŒ₯ α‹°αˆ 15 αˆ΄α‰Άα‰½ 1-64 rank α‹‰αˆ΅αŒ₯  α‰’αŠ–αˆ© α‹¨α‰€αˆ©α‰΅ 15 αˆ΄α‰Άα‰½ α‰  αŠ αˆ‹α‰Έα‹ rank compete α‹«α‹°αˆ­αŒ‹αˆ‰α’

‎So  15 α‰  rank ሡለ αŒˆα‰‘ የAffirmative Action Qouta αŠ α‹­α‹™αˆ α’

‎ α‹¨α‰€αˆ©α‰΅ 10 αˆ΄α‰Άα‰½ αŒαŠ• ለምሳሌ 100-160 α‰’αˆ†αŠ• α‰ Affirmative Action Quota 15  ሡለ αˆ†αŠ•   10 α‹˜αŠ“ α‰₯αˆˆα‹ˆ α‹­αŒα‰£αˆŽ   αŠ₯αŠ•α‹°αˆαˆ 5 free Quota α‹­αŠ–αˆ«αˆ αˆ›αˆˆα‰΅αˆ   ከ160 α‰ α‹‹αˆ‹ α‹«αˆ‰α‰΅ 5 αˆ΄α‰Άα‰½ αŠ¨αˆ™αˆ‰   α‹«αˆˆαˆαŠ•αˆ Risk Soft α‹­αŒα‰£αˆ‰α’


‎Mostly α‰°αˆ›αˆͺ α‰ αŠ αŠ•α‹°αŠ› α‹¨αˆšαˆ˜αˆ­αŒ α‹ Software ,CS,Elec ,Bio ,IT  αŠα‹ αˆ΅αˆˆα‹šαˆ 1-100 rank α‹«αˆ‰α‰΅ αˆαˆ‰αˆ Software α‹­αˆ˜αˆ­αŒ£αˆ‰  αˆšαˆˆα‰΅ αŠ α‹°αˆˆαˆ  αŠ₯αŠ” Just Worst Case senario α‹ˆαˆ΅αŒ„ αˆαˆ‰αˆ soft α‰’αŒˆα‰‘ α‰₯ዬ አሡα‰₯ αŠα‹ 1-64  α‹ˆαˆ΅αŒ₯ Elec,Cs,Bio αˆšαˆ™αˆ‹ ሡለ αˆšαŠ–αˆ© α‹¨αˆαˆαˆαŒ‰α‰΅ dep. α‹¨αˆ˜αŒα‰£α‰΅ Chance α‹­αŠ–αˆ―α‰Έα‹‹αˆ αˆ›αˆˆα‰΅ αŠα‹α’



@ProgrammingWithFaith2018
❀2πŸ‘1
Media is too big
VIEW IN TELEGRAM
Spider-Man: Brand New Day (2026) 1080p V3-HDTC Multi-LiNE [English + Hindi + Tamil +Telugu] ESub

πŸ•Έ@filmbet28
Forwarded from Jimma University CS 2015
How is the grade given for the internship? πŸŽ“


For IT, CS, and IS, it will count as one course, and the grade is based on how much you get. πŸ“Š

Ass1 represents the result from the companyβ€”it is worth 50% of the total grade. However, the company will give you a score out of 100%, which will then be divided by 2 to convert it to a score out of 50%.

For example, if the company gives you 94 out of 100%, in Ass1 it will be divided: 94/2 = 47.

Ass2 is evaluated by your advisor based on your report and is worth 25%. πŸ“
So far: 50 + 25 = 75.

The remaining 25% is split into:

βœ…Quiz (5%) – they will ask you questions after your presentation. πŸ—£οΈ
βœ…Final Examination (20%) – your presentation and document will be evaluated while you present. 🎀

Example:
If the company gives you 100 out of 100, your advisor gives you 24 out of 25, you get 4 on the quiz, and 17 on the final exam:

βœ…Ass1 = 50
βœ… Ass2 = 24
βœ… Quiz = 4
βœ…Final Examination = 17

Total = 50 + 24 + 4 + 17 = 95 β†’ which is an A+.

@jucs_2015
#Cs
#Internship
❀1