Computer Science Midterm Exam Review Questions
11. What is a pointer?
12. Are pointers and array names the same thing? How are they alike? How do they differ?
11
Ans:
Pointer: Pointer is variable which stores the address of a variable .
Ex:
int num=10;
int *ptr=&num ; // it means here ptr is a pointer variable and we are storing address of num in this pointer variable
Ex:
int a[10];
int *ptr=a; // here ptr is a pointer variable and we are storing the base address of array in this array variable.
12
Ans:
Yes we can assume that both pointers and array names are same thing.
But sometimes we use array names and some times we use pointer to that array
Ex:
If we want to interate through the array in the main function then
for(i=0;i<n;i++)
printf("%d",a[i]); // here this a[i] prints all elements of array;
If we want to pass the array to some function and we have to print array values then we use pointers
void printing(int *arr,int arr_len)
int i=0;
for(i=0;i<arr_len;i++)
printf("%d",(arr+i)*); // here it will print array values
int main()
int a[10],n=10;
printing(a,n);
Computer Science Midterm Exam Review Questions 11. What is a pointer? 12. Are pointers and array...
Computer Science Midterm Exam Review Questions 5. What is a struct, and how do you declare one? 6. Define a struct and use it to solve a simple problem. 7. What is the main difference between structs in C and C++
Computer Science Midterm Exam Review Questions 21. How do you dynamically allocate variables in C++? 22. How do you dynamically allocate an array in C++? 23. How do you deallocate variables in C++? 24. How do you deallocate arrays in C++? 25. How do you dynamically allocate memory in C? 26. How do you deallocate memory in C?
CSCI 3000 Homework 4In this assignment, you will implement a simple version of Computer Lab administration system in C++. Your program will monitor computers in 4 computer labs and will allow users to log in and log out. Each computer lab has different number of computers.· Lab 1 has 10 computers· Lab 2 has 6 computers· Lab 3 has 3 computers· Lab 4 has 12 computersHere is a sample state of the system:Lab ArraySome of the computers are free (no...
home / study / engineering / computer science / computer science questions and answers / in basic c please with comments so i can redo it on my own, thank you! for this lab, you only ... Question: In basic C please with comments so I can redo It on my own, thank you! For this lab, you only nee... In basic C please with comments so I can redo It on my own, thank you! For this lab, you...
Is for study for an exam, thanks.
Some Review Questions/Exercises • • Convert a * b/c - d to posfix notation Provide an algorithm and evaluate the following postfix expression: 8 3 / 4 + Explain how we can use a deque to implement a queue. What are two possible prototypes for the pop() operation? Why is it more difficult to implement a queue with an array than implementing a . stack with an array? •
Stuck on this computer science assignment
Write a program that demonstrates binary searching through an array of strings and finding specific values in an corresponding parallel double array. In all cases your output should exactly match the provided solution.o.
Provided files:
Assignment.cpp - starter assignment with function prototypes
companies.txt - file for program to read.
earnings.txt - file for program to read.
Input1.txt
Input2.txt - Test these inputs out manually, or use stream redirection
Input3.txt - These inputs are based...
80% of the employees in a specialized department of a large software firm are computer science graduates. A project team is made up of 8 employees.Part a) What is the probability to 3 decimal digits that all the project team members are computer science graduates? Part b) What is the probability to 3 decimal digits that exactly 3 of the project team members are computer science graduates? Part c) What is the most likely number of computer science graduates among the 8 project team members?...
Computer science question 1.I am thinking about my birthday. How many yes/no questions would you have to ask me to find out which month I was born in? A. 12 B. 6 C. At least 3, but possibly 4. D. At least 4 E. log2(2^12) 2.Now you have to guess everyoneʼs birth month. What is the average number of yes/no questions you will have to ask everyone? A. 12 B. 6 C. ⌈ log2(12) ⌉ D. log2(12) E. log2(2^12)
Can these questions be answered for my midterm review? Thank you! 1) Suppose a company purchased land and a building for $16,225,538 cash. The appraised value of the building was $12,355,025, and the land was appraised at $7,784,271. What dollar amount of the purchase price will be allocated to the Building account? *Note: for calculations, please do not round the percentage. 2) At the beginning of 2023, Apu purchases a new Squishee machine for the Kwik-E-Mart with a cost of...
chapter 11 review questions
1 The plants examined in this exercise are considerably larger than the bryophytes why 2 What are two characteristics of Pou that indicate it lives in dry habitats? REVIEW QUESTIONS 11 What are two traits of totum that make it traditionally regarded as the most primitive of the vascular plants? (13) 4 How does the life cycle of these plants differ from that of the bryophytes? Bryophytes: Plants from this lab: 5 (15) Define or explain...