New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CIS 300 Midterm Exam 1 Study Guide

by: Laurel Knust

CIS 300 Midterm Exam 1 Study Guide CIS 300

Marketplace > Kansas State University > Computer Programming > CIS 300 > CIS 300 Midterm Exam 1 Study Guide
Laurel Knust
GPA 3.15

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Midterm study guide for CIS 300
Algorithms & Data Structures
Rodney R. Howell
Study Guide
CIS, 300, CIS300, data, programming, structures, C#, code, coding, Computer
50 ?




Popular in Algorithms & Data Structures

Popular in Computer Programming

This 4 page Study Guide was uploaded by Laurel Knust on Monday September 19, 2016. The Study Guide belongs to CIS 300 at Kansas State University taught by Rodney R. Howell in Summer 2016. Since its upload, it has received 8 views. For similar materials see Algorithms & Data Structures in Computer Programming at Kansas State University.


Reviews for CIS 300 Midterm Exam 1 Study Guide


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/16
Name: Model Solution CIS 300 Exam 1 This is a 50-minute closed-book exam. Use your time wisely. No cal- culators or other electronic devices are allowed. Please silence and put away all phones and put away all watches. If you run out of room, you may use the backs of these pages. In all code that you write, follow the the programming style requirements for this course; however, you do not need to follow the requirements for comments or formatting. For each question, you will be graded in part on the efficiency of your code. The last page contains documentation for your reference — you may remove it if you wish. 1. (20 points) Two private fields are defined below, where the LinkedListCell<T> type is as defined on the last page. Fill in the MoveCell method below to move the first cell of the linked list given by _firstList to the beginning of the linked list given by _secondList. For example, if _firstList refers to a list containing the sequence ▯10, 20, 30▯, and _secondList refers to a list contain- ing the sequence ▯1, 2, 3, 4▯, then calling MoveCell should cause _firstList to refer to a list containing ▯20, 30▯, and _secondList to refer to a list containing ▯10, 1, 2, 3, 4▯. If _firstList is null, the method should throw an InvalidOperationException. You should assume that there is other code that may have changed the values of _firstList and _secondList before MoveCell was called. You may not construct any new LinkedListCells — instead, you must move an existing cell. You may not add any code outside the MoveCell method. private LinkedListCell<decimal> _firstList; private LinkedListCell<decimal> _secondList; private void MoveCell() { if (_firstList == null) { throw new InvalidOperationException(); } LinkedListCell<decimal> p = _firstList; _firstList = _firstList.Next; p.Next = _secondList; _secondList = p; } 2. (45 points) Fill in the method stub below so that it displays the given OpenFileDialog to the user, and if the user selects a file, returns a StringBuilder containing every second character from the selected file. For example, if the user selects a file containing the single line (there is no white space at the beginning or end): 1234567890 - the ten digits. the method should return a StringBuilder containing, “24680-tetndgt.”. If the user does not select a file, it should return null. If an exception is thrown while the file is being read, the exception should be displayed in a MessageBox, and null should be returned. You may assume that fd is not null. You may not add any code outside of this method. private StringBuilder GetEverySecondCharacter(OpenFileDialog fd) { StringBuilder sb = null; if (fd.ShowDialog() == DialogResult.OK) { try { string s = File.ReadAllText(fd.FileName); sb = new StringBuilder(); for (int i = 1; i < s.Length; i += 2) { sb.Append(s[i]); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } return sb; } 3. (35 points) Fill in the method stub below so that it removes all el- ements from q and returns a stack containing, from top to bottom, the elements given in q from front to back, followed by the elements given in q from back to front. For example, if q initially contains, from front to back, the sequence ▯1, 2, 3, 4▯, then the stack returned should contain the sequence, from top to bottom, ▯1, 2, 3, 4, 4, 3, 2, 1▯, and q should end up being empty. You may use any additional data structures that you feel are appropriate. You may assume that q is not null. You may not add any code outside of this method. private Stack<int> MoveToStack(Queue<int> q) { Stack<int> temp = new Stack<int>(); Stack<int> result = new Stack<int>(); while (q.Count > 0) { temp.Push(q.Dequeue()); result.Push(temp.Peek()); } while (temp.Count > 0) { result.Push(temp.Pop()); } return result; } The LinkedListCell<T> class contains the following public members: • Data: a property of type T that gets or sets the data stored in the cell. • Next: a property of type LinkedListCell<T> that gets or sets the next cell in the list. • A constructor that takes no parameters and constructs a cell whose Data property is the default value for type T and whose Next prop- erty is null.


Buy Material

Are you sure you want to buy this material for

50 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Amaris Trozzo George Washington University

"I made $350 in just two days after posting my first study guide."

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.