Chapter 1 Getting started
Chapter 1 Getting started
Getting started
[A] Which of the following are invalid variable names and why?
BASICSALARY
● It is a valid variable
_basic
● It is a valid variable
Basic-hra
● Hyphen is not valid between 2 words
#MEAN
● # is not valid in the name of a variable
group.
● Full stop is not valid in the name of a variable
422
● Variable has combination of letters and digits.not only digits
population in 2006
● There shouldn't be any gap between words
over time
● There shouldn't be any gap between words
Mindovermatter
● It is a valid variable
FLOAT
● It is a valid variable
hELLO
● It is a valid variable
queue.
● Full stop is not valid in the name of a variable
team’svictory
● ‘ is not valid in the name of a variable
Plot # 3
● There shouldn't be any gap between words
2015_DDay
● Variable starts with digits making it invalid
(d) main( )
{
printf ( "nn \n\n nn\n" ) ;
printf ( "nn /n/n nn/n" ) ;
}
Output: nn
nn
nn /n/n nn/n
(e) main( )
{
int a, b ;
printf ( "Enter values of a and b" ) ;
scanf ( " %d %d ", &a, &b ) ;
printf ( "a = %d b = %d", a, b ) ;
}
(f) main( )
{
int p, q ;
printf ( "Enter values of p and q" ) ;
scanf ( " %d %d ", p, q ) ;
printf ( "p = %d q =%d", p, q ) ;
}
Output: Error