0% found this document useful (0 votes)
60 views3 pages

CS1181 - Intro-To-Computer-Science - ISU - 2024 - MIDTERM - Study Guide

Uploaded by

cyberguyhurst
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views3 pages

CS1181 - Intro-To-Computer-Science - ISU - 2024 - MIDTERM - Study Guide

Uploaded by

cyberguyhurst
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Idaho State University Fall, 2024 CS 1181

Study Guide for Midterm

Week 1
1. Discuss compile time error vs runtime error with example
2. What are the different levels (high, mid, and low) of programming languages and discuss some
differences among those?
3. What is Algorithm, discuss the approach of an algorithm that may help you organize a number
of integers in non-decreasing order

Week 2
1. Given a decimal number, show me the steps to convert it to the equivalent binary number (slide
6, 7)
2. Given a binary number, show the steps to get its decimal equivalent (slide 5)
3. Given a binary number, translate it to corresponding hexadecimal equivalent (slide 10)
4. Given a positive binary number, find the 2’s complement (slide 13)

Week 3:
1. What is function prototype and why do you need that? Explain with example(s).
2. What is function overloading, since a function can have the following parts: a function name, a
return type, argument(s), function body. What can we change or cannot change in the
overloaded function(s)?
3. Discuss with example defaults arguments in function
4. Discuss function arguments passing by value and passing by reference
5. What is inline function and what is the benefit/use of inline function
6. Review the slides explaining scope of variables (slides 40-43)

Week 4:
1. Discuss LValue and RValue with example (slide 6)
2. Discuss correctness and incorrectness of increment & decrement operations. The exam question
may come in the form that you will be given similar examples to slide 15 and ask whether the
compiler will raise an error
3. Discuss operator precedence, associativity, and evaluation order (slide 17)
4. If you pass an array as function argument, is it by passed by value or by reference? Discuss the
reasoning behind such behavior.
Idaho State University Fall, 2024 CS 1181

Week 5:
1. Given a code snippet for pointer operations as such in slide 4, show the values or states of
the memory locations
2. Discuss passing an argument by reference using pointer in C++ (slide 3)
3. What could be the values of different variables for different operations as discussed in slide
17
4. Review the code examples in slide 19, 20, 21

Week 6:
1. What is structure and why do we need structure (slide 2)?
2. What are some features of structures (slide 9 to 13)

Programming Problems to Practice:


1. You are given an array of integers arr and the size of the array sz. You need to write a function to
reverse the order of the integers in the array.
Input: arr={9, 4, 8, 0, 1, 0, 6}, sz = 7
Output: arr={6, 0, 1, , 8, 4, 9}
2. You are given an input array (arr_in) and output array (arr_out) and the size of both arrays sz,
where there are 0s and non-zero integer values. You need to left-align the non-zero elements of
the input array and put them in the output array while maintaining the relative order, all the 0s
will be on the right in the output array. For instance, if the input array is {5, 3, 0, 0, 9,
1, 2, 0, 4} and sz is 9, your output array will look like this {5, 3, 9, 1, 2, 4, 0,
0, 0}.

3. Bonus problem: can you solve problem 2 without the output array, i.e., modify the
input array while maintaining the relative order of the non-zero elements and return it
as the output.
4. Given an input positive integer, compute the factorial of that number. Can you do the
computation using recursive function.
5. Compute Fibonacci series recursively.

6. Given a positive integer, write a function to check if that number is prime number.

7. Given a string, write a function to check whether the string is a palindrome.

8. Given a positive number, write a function to verify whether the number is a perfect
number.
9. Given a string, return the reverse of the string.
Idaho State University Fall, 2024 CS 1181

10. Practice and understand the Problem given in you Programming Lab 2 and 3.

11. Practice the programming problems on slide 44 (pop quiz) of Week 3.

You might also like