Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

QUESTION 30 A string is a series of _______________ treated as a single unit. ch

ID: 3918048 • Letter: Q

Question

QUESTION 30

A string is a series of _______________ treated as a single unit.

characters

arrays

integers

markers

5.00000 points   

QUESTION 31

If a debugger is not available, a programmer typically uses _________ statements to see the values that are recorded.

if

scanf

printf

while

5.00000 points   

QUESTION 32

The ____________ executes before a program is compiled.

C Executor

C Compressor

Pre-compressor

C PreProcessor

5.00000 points   

QUESTION 33

A double backslash (\) places a _______________ in a string.

Single Backslash

New Line

Function

Double Quote

5.00000 points   

QUESTION 34

A ______ character is appended to the array when reading terminates.

rend

constant

null

return

5.00000 points   

QUESTION 35

Function _________ searches for the first occurrence of a character in a string.

strtok

strchr

strcspn

strspn

5.00000 points   

QUESTION 36

Using the functions in the C standard library helps make programs more __________.

viable

standard

portable

generic

5.00000 points   

QUESTION 37

______ nodes contain two or more links.

Multicover

Spanned

Tree

Passive

5.00000 points   

QUESTION 38

Functions are invoked by a _______________

Variable Invoke

function call

Method

Program Call

5.00000 points   

QUESTION 39

A structure’s size is not necessarily the sum of the sizes of its members.

True

False

5.00000 points   

QUESTION 40

Function isprint determines whether a character can be displayed on the screen.

True

False

C++ questions

characters

arrays

integers

markers

Explanation / Answer

ANS 30 : Option a (A string is a series of characters treated as single unit and terminated by a null character )

ex: string s="hello"; // a series of characters bydefault terminated by null character

char*s="hello"; //a series of characters bydefault terminated by null character

char s[]={'a','e','i','o','u',''}; //for character array to be a string we have to terminate it by a null char..

Ans 31: option a (if)

if statement is to validate something

for ex:

#include<iostream>

using namespace std;

int main()

{

int a=5,b=6;

int sum=a+b;

if(sum==11) // here we r debugging or checking the condition if sum is equal to 11 or not if yes //return 1 else retuen 0

return 1;

else

return 0;

}

Ans 32: option d (C Preprocessor)

This phase before compilation of the program is Pre-processing of source program This phase include:

Removal of Comments

Expansion of Macros

Expansion of the included files.(which contains basic input/output function ex:printf(),scanf() definition)

Ans 33: option a ( \ places a single slash . The reason that you need to “double” the backslash character is because C uses a single backslash to indicate that a special character follows. These are called “escape sequences” so to indicate a you must have to use an before it to specify that a special character follows.

Ans 35 : option c (strcspn() which take 2 arguments)

int strcspn(const char*string1,cons char*string2)

string 1:The target string in which search has to be made

string 2: string containing character to match with target strings i.e. string 1

output/Returns : This function search for the first occurence of character in the both string and returns number of characters before the first occurenceof character in the both strings.

Example:

#include<stdio.h>

#include<string.h>

int main()

{

char s1="priya";

char s2="agrawal";

int x=strcspn(s1,s2);

printf("%d ",x);

}

Output: 1 // number of unmatched characters in target string before the first occurence of character //(i.e. 'r' in this case)in the both strings

Ans 36: using the standard library function of c ,our program become more portable.

Library Function: These are inbuilt functions which are grouped together and placed in a common place called library. and the function are portable so with the changing real world needs, it is easier for everyone to run its application every time, everywhere.So using the standard library function which are portable,portablity of our program get increases.

Ans 38: A function is called by a function call.

// function_name(actual parameters);

//actual parameters : variable at the time of calling

ex:

#include<iostream>

using namespace std;

int sum(int a,int b); //function declaration needs to be done if the function is defined after it's calling

int main()

{

int a=5,b=6;

int s=sum(a,b)// function calling now will go to function definition acc to function name and //parameters

printf("%d",s);

}

//function definition

int sum(int x,int y)

{

return x+y;

}

output: 11 // as sequence goes to func definition which take value in it's formal parameters(x,y) acc //to function call and returns x+y which is stored in s(inside main function)

Ans 39: True

this is done due to padding added to satisfy alignment constraint. In structure size of block is the size of data type required largest bytes nd sizeof structure is dependent on alignment of their members.

for ex:

struct x{

short a;

int b;

char c;

}

size= 12 bytes

each r 4 byte block

struct y{

int i;

char c;

short s;

}

size= 8 bytes

each block are of 4 byte block

difference lies in the alignment of member of structure.
Ans 40: A printable character :is a character that occupies a printing position on a display and is checked by isprint() fxn in c++.Ans 40: Option A (true )

2 byte for short and 2 byte of padding 4 byte for int 1 byte for char and 3 byte padding
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote