What is the output of this program (if any)
#include<iostream.h>
using namespace std;
void main()
{
int num=123;
int *p_num;
cout<<"if any"<<"\n";
cout<<num<<"\n";
cout<<&num<<"\n";
cout<<*p_num<<"\n";
cout<<p_num<<"\n";
}
Write a C++ program that outputs the following elements in the diagram using Queue data structure
what is the index of the second element of an array
what is the index number of the last element of an array of size 20
2. Give at least three examples that show different features of string slices. Describe the feature illustrated by each example. Invent your own examples.
1. Consider the loop from Section 8.3 of your textbook.
prefixes = 'JKLMNOPQ'
suffix = 'ack'
for letter in prefixes:
print(letter + suffix)
Put this code into a Python script and run it. Notice that it prints the names "Oack" and "Qack".
Modify the program so that it prints "Ouack" and "Quack" but leaves the other names the same.
Include the modified Python code and the output in your submission.
Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source.
Nested lists
The “*” operator
List slices
The “+=” operator
A list filter
A list operation that is legal but does the "wrong" thing, not what the programmer expects
Provide the Python code and output for your program and all your examples.
Write a Python program that does the following.
Create a string that is a long series of words separated by spaces. The string is your own creative choice. It can be names, favorite foods, animals, anything. Just make it up yourself.
Turn the string into a list of words using split.
Delete three words from the list, but delete each one using a different kind of Python operation.
Sort the list.
Add new words to the list (three or more) using three different kinds of Python operation.
Turn the list of words back into a single string using join.
Print the string.
Describe the difference between objects and values using the terms “equivalent” and “identical”. Illustrate the difference using your own examples with Python lists and the “is” operator.
Describe the relationship between objects, references, and aliasing. Again, create your own examples with Python lists.
Finally, create your own example of a function that modifies a list passed in as an argument. Describe what your function does in terms of arguments, parameters, objects, and references.
Create your own unique examples for this assignment.
Create a program that will display the corresponding remark of a given input grade. The range of grades and its corresponding remark are given below:
Note: Use switch case statement
Range of Grades Remarks
90-10 Excellent
80-89 Good
75-7 Fair
50-74 Poor
Other grades Out-of-range