41. FALSE
eg: int a[10]
you can store 10 values.
42. d)ONLY WHEN OPENING THE FILE STREAM
eg:
FILE *fp;
fp = fopen("test.txt", "w+"); // we use filename only while opening the file stream
fprintf(fp, "writing..\n") // we use file pointer while writing to a file
fclose(fp);
43. FALSE
Since, flow chart accomodates all possible senarios of the problem and gives you an accurate algorithm. You can also cross check your algorithm with flow chart to uncover any discrepencies. Flow chart is used to design an algorithm.
44. TRUE
Proper spacing can improve code's readability and understandability.
45. convert-temp
your function name should always reflect its purpose. This can avoid a lot of confusion.
46. TRUE
it is perfectly alright to have a function withour any arguments. Such functions always make use of constants for calculation or simply to print something.
47. TRUE
if you have an int pointer *i. it will be referencing to address 1000 (i=1000 say). you increment the pointer by 1. this will add the size of integer to the base address which will give you 1004 ( size of int =4 (say) this can vary compiler to compiler). similarly if you add 2 to i, you are actually referencing address 1008 ( 1000+ (4*2))
48. FALSE
you can have more than one i/o different streams open simultaneously. But the stream( files) should not be same.
49. FALSE
It depends on the data type of the array. if it is an integer array you can store only integer elements. if it is a character array you can store character elements. Java also supports array of strings.
50. TRUE
in java and c++, String class can be used as data type to declare a variable of string type and store strings. In reality String is a class.Its constructor gets invoked when it is used.
51. TRUE
String s1="aaa"
String s2="aaa"
if (s1==s2) will result in TRUE
this is because s1 is created and it points to memory location 1000 which stores value "aaa". on executing 2nd statement s2 is not created instead it is poitning to the same location 1000. therefore it returns true.
This would not be true if s1 and s2 were created using NEW operator.
52. TRUE (C++)
FALSE (JAVA)
in java String class is in java.lang package which is imported by default.
53. TRUE
A pointer variable stores address of a variable.
eg : int *p;
p=&a // address of a is stored in pointer variable p
ALL THE BEST :)
please answer all question CSE 110 Introduction to Computer Science 41. An array of size 10,...
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...
Hi I how do i use a vector to search a array for a string that user has enter into the console. here is some of the instructions for the programing I am trying to work on The purpose of this program is to write a class whose job is to read up to 10,000 names into a string array. The class sorts the names and then the user can ask the class to find full names containing a name...
**** ITS MULTI-PART QUESTION. PLEASE MAKE SURE TO ANSWER THEM ALL. SOLVE IT BY JAVA. **** *** ALSO MAKE SURE IT PASS THE TESTER FILE PLEASE*** Often when we are running a program, it will have a number of configuration options which tweak its behavior while it's running. Allow text completion? Collect anonymous usage data? These are all options our programs may use. We can store these options in an array and pass it to the program. In its simplest...
Java console-based question. Do not use BufferedReader please. A file named customers.txt contains the names of customers for a local hairdressing salon. Unfortunately, the data in the file is in no particular order yet the owner of the salon would like the data in alphabetical order. Write a Java program that reads the contents of the file into an array of Strings, sorts the array of Strings into alphabetical order, and then writes the content of the array to a...
Lab 19 - History of Computer Science, A File IO Lab FIRST PART OF CODING LAB: Step 0 - Getting Starting In this program, we have two classes, FileIO.java and FileReader.java. FileIO.java will be our “driver” program or the main program that will bring the file reading and analysis together. FileReader.java will create the methods we use in FileIO.java to simply read in our file. Main in FileIO For this lab, main() is provided for you in FileIO.java and contains...
C programming 1) When setting a two-dimensional character array, how is the size (number of characters) in the second dimension set? Select an answer: The number of elements are equal to the average size of all the strings. To the length of the longest string; you don't need to add one because the first array element is zero. To the length of the longest string, plus one for the null character. The second dimension is equal to the number of...
You are going to implement Treesort algorithm in C++ to sort string data. Here are the steps to complete the homework 1) Use the following class definition for binary search tree nodes. Its constructor is incomplete you should first complete the constructor. class TreeNode t public: string data; / this is the string stored in the node TreeNode left: TreeNode right; TreeNode (string element, TreeNode 1t, TreeNode rt //your code here 2) Write a function that will insert a string...
[C++]
Outline:
The movie data is read from a file into an array of structs and
is sorted using the Selection Sort method and the search is done
using the Binary Search algorithm with the year of release as key.
This assignment upgrades to an array of pointers to the database
elements and converts the Selection Sort and Binary search
procedure on the database to selection sort and binary search on
the array of pointers to the database.
Requirements:
Your...
Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[10] [ 50]; -each row will be a...
Detecting Substrings (C++ Version) Introduction A very common task that is often performed by programs that work with text files is the problem of locating a specific substring within the file. I am sure we’ve all done this many times when working with Word, Notepad, or other editors. Since we don’t have a GUI or other means of displaying the contents of a file all at once, let’s modify the problem slightly. Rather than locating a specific substring within a...